How would it be possible to do this? text recognition.

Sorendere

New member
I have the click option with UI enabled. But I need to give a different priority. I need you to click on the word "PREMIUM TIP". The problem is that sometimes these two words come together in the same text and I need you to send me the last one.

Is there a way to make MacroDroid select the word in order from bottom screen to top screen?

Would there be any alternative for this?


JO5hJ82.png
 

FrameXX

Well-known member
Try to use "identify in app" option or the "element id" option if you already know the element id. The text may be the same, but id should differ as far as I think.
 

RSF

Well-known member
Just in case your app doesn't use unique ID's for each of those Tip Premium panels (some apps are good about that kind of thing, some aren't), you could use MacroDroid's new "Read Screen Contents" action to get everything shown on that app's screen into a MacroDroid dictionary-type variable, and then iterate through that dictionary variable looking for the last instance of "Tip Premium", and then click on the specific ID that the "Read Screen Contents" action gives you.

That's all new capability for MacroDroid (dictionaries, iteration, and ability to use dictionary values in UI Interaction actions), so please feel free to ask for more info if that's not clear. A good first step would be to create a macro to get the app's screen contents into a variable that you could then look at, manually, in MacroDroid, to give you a sense of the information available (in this example I'm looking at the screen contents of an alarm app called "Sandman"):

ReadScreenContents.png

ContentsResults.png
 

bangity

New member
Just in case your app doesn't use unique ID's for each of those Tip Premium panels (some apps are good about that kind of thing, some aren't), you could use MacroDroid's new "Read Screen Contents" action to get everything shown on that app's screen into a MacroDroid dictionary-type variable, and then iterate through that dictionary variable looking for the last instance of "Tip Premium", and then click on the specific ID that the "Read Screen Contents" action gives you.

That's all new capability for MacroDroid (dictionaries, iteration, and ability to use dictionary values in UI Interaction actions), so please feel free to ask for more info if that's not clear. A good first step would be to create a macro to get the app's screen contents into a variable that you could then look at, manually, in MacroDroid, to give you a sense of the information available (in this example I'm looking at the screen contents of an alarm app called "Sandman"):

View attachment 2839

View attachment 2841
Can you please post your code? I am having a hard time trying to find the variable that Read Screen Content created so I can iterate through each one. Thank you,
 

RSF

Well-known member
Sure; it's attached. The variable configured on the Read Screen Contents action is in the "Local Variables" panel, like other local variables:
Screenshot_20221129-082108_2.png
 

Attachments

  • Read_screen_into_dictionary.macro
    1.6 KB · Views: 20
Top