How can I search in code?

My game is more than 14000 blocks. How can I search in code? And how can I replace something in code? Other program langueage ( e.g. Delphi) provided this opportunity.

There are several ‘searching’ options in App Inventor 2 (nothing exactly like in Delphi).

1) Search for a text in Blocks
If you use a Chrome Browser, you can do this:

2) Search for a component

Start typing in a white area on you Blocks screen ‘label’ and you find this:


Click on one of the MENU options and the particular block will miraculously appear.

3. Sort your Blocks

Right click on the Browser white space and you get this MENU. Select Sort Blocks by Catagory. This arranges existing blocks in a logical manner (at least for some developers).

There might be a few more ‘tricks’ … the real trick is to avoid 14,000 blocks by reusing components etc. Have you set a record? Perhaps. Consider following Enis’s tips


1 Like

I know it’s not what you asked but 14000? Have you used the generic or “any component” blocks?
How about procedures? Do you have lots of code that looks the same but only changes the component? That can be optimized.
Take that in consideration. I’ve reduced my blocks almost to the half sometimes when optimizing.

1 Like

Thanks for the help but I can do program (25 years practice) and my game after 2 years development and optimization 15588 blocks now.
I asked if there was an easy way to search or replace any items in code. (as in most program language)

Best bet is CTRL+F
With all your programming experience everything will have a specific name - variables/blocks/etc. so should be reasonably easy to find things
There is also the highlight procedure feature

I don’t think you understand the problem. I can’t scan 10,000 lines manually if I search or replace a variable.

Exactly! These are the tools available with App Inventor 2. Either reduce your Block count sensibly, use the search methods available (as difficult as they are with a huge block count) or revert to Delphi (a very nice professional compiler). We do understand. Perhaps some day there will be another way to find specific code; today this is what is available. What is discussed is what is available with the App Inventor 2 Block language. This educational compiler was never intended to be able to make HUGE apps (but it can). It is built as an educational tool to teach programming concepts and as a stepping stone to learning Java. Java has advanced search features (Android Studio).

OK everything is clear and understandable.
Closing this thread, I understand the message. Anyone trying to create something larger than one page should look for another option. All right.

1 Like