Capturing on-screen text

MRlooney

New member
how exactly I do this? I want to detect, copy some text from a chrome tab, then save the value (number value) to a variable so I can run some tests on it
 

hsurB

Well-known member
Action: Read screen content - [New variable] - Global (if you want to use it in other macros) / Local (Only for this macro) it can be changed later - Name it - This dictionary - Exclude view ids without text to reduce amount of keys or Include to save them even if they are empty - Exclude or Include overlays (for exemple to save status bar of your phone) and thats it.

Then you go to main screen of macrodroid, you open Variables menu to see how it looks like and where the value you are interested in is stored
 

MRlooney

New member
Action: Read screen content - [New variable] - Global (if you want to use it in other macros) / Local (Only for this macro) it can be changed later - Name it - This dictionary - Exclude view ids without text to reduce amount of keys or Include to save them even if they are empty - Exclude or Include overlays (for exemple to save status bar of your phone) and thats it.

Then you go to main screen of macrodroid, you open Variables menu to see how it looks like and where the value you are interested in is stored
Is there any other way? I can't pay for the pro version , online payments are completely blocked in my country
 

hsurB

Well-known member
Does this action require pro version or only if including overlays (whats not needed in your case)? I can't tell cause I have full version.
 

hsurB

Well-known member
Maybe you could do it with read screenshot contents but again - not sure if it works on free version.
Alternatively you could contact developer and maybe you guys will find a way to make a purchase
 

MRlooney

New member
Maybe you could do it with read screenshot contents but again - not sure if it works on free version.
Alternatively you could contact developer and maybe you guys will find a way to make a purchase
okay, how do I contact the developer?
 

MRlooney

New member
Action: Read screen content - [New variable] - Global (if you want to use it in other macros) / Local (Only for this macro) it can be changed later - Name it - This dictionary - Exclude view ids without text to reduce amount of keys or Include to save them even if they are empty - Exclude or Include overlays (for exemple to save status bar of your phone) and thats it.

Then you go to main screen of macrodroid, you open Variables menu to see how it looks like and where the value you are interested in is stored
Hi, how you are still following this thread, I did what you told me, got the dictionary, now I need to know how to extract a single entry from it and store it as a variable so I can run some checks on it
 

hsurB

Well-known member
After the action is performed, screen content is stored in that dictionary.
You need to go to main menu of macrodroid - variables - find that dictionary and check under what key is stored whatever you want.

Then you can access it wherever you want using {v=Screen[Key]} where Screen is name of your dictionary and Key is name of a key (use lv if its local variable instead v). Using that would get you a value of that particular key.

 

MRlooney

New member
After the action is performed, screen content is stored in that dictionary.
You need to go to main menu of macrodroid - variables - find that dictionary and check under what key is stored whatever you want.

Then you can access it wherever you want using {v=Screen[Key]} where Screen is name of your dictionary and Key is name of a key (use lv if its local variable instead v). Using that would get you a value of that particular key.

So I was able to successfully do that but I can't figure out how to do my checks. basically I need to check if the value of (timer) has changed by -2 in 2 secs or not.
 

Attachments

  • photo_2024-04-22_20-29-43.jpg
    photo_2024-04-22_20-29-43.jpg
    71.4 KB · Views: 10
Last edited:

hsurB

Well-known member
Not sure if I understood correctly but since you are setting another variable to the value from dictionary, after 2 seconds you can run read screen content again and then use set variable to calculate the difference between {lv=This dictionary[timer]} and {lv=timer} and then use if clause (compare values) to perform actions if it matches your needs.
Alternatively maybe you could even use only if clause (compare values) depending on how it exactly look like in your case
 

MRlooney

New member
Not sure if I understood correctly but since you are setting another variable to the value from dictionary, after 2 seconds you can run read screen content again and then use set variable to calculate the difference between {lv=This dictionary[timer]} and {lv=timer} and then use if clause (compare values) to perform actions if it matches your needs.
Alternatively maybe you could even use only if clause (compare values) depending on how it exactly look like in your case
I am so thankful for your help and time. I was able to make it work using this. this reads screen content every 2 secs. and the value of timer before and after 2 secs (neotimer is value of timer after 2 secs). if they are equal (meaning no change happened). It will alert me by raising the volume and playing a song
 

Attachments

  • photo_2024-04-23_18-46-18.jpg
    photo_2024-04-23_18-46-18.jpg
    74 KB · Views: 4
  • photo_2024-04-23_18-46-13.jpg
    photo_2024-04-23_18-46-13.jpg
    65 KB · Views: 4

hsurB

Well-known member
Great. Just to clarify - dictionary is one big variable that contains other variables under keys.
That means you don't even have to use set variable action to create another variables that you later set to the value from dictionary.
You could be comparing them in if clause directly.

If {lv=This dictionary[timer]} = {lv=dic[timer]}

At least it should work like that, sometimes I do it like you did anyway since that might be clearer or easier to manage
 
Top