If Condition Screen Content

xMaster247

New member
Hi Everyone,

I have made a macro, I want to set the IF Condition when specific screen content appear or disappear then allow or prevent action.

screen content trigger somehow working for me, but as my primary trigger is day/time trigger, so when screen trigger fired then it repeats the entire macro.

Please reply, if someone has solution or suggestion.
 

Jacob L

Moderator (Lawsonator)
Use trigger not fired in the if statement and set it to the day time trigger. Then wrap the if statement round the actions you don't want to run
 

xMaster247

New member
Use trigger not fired in the if statement and set it to the day time trigger. Then wrap the if statement round the actions you don't want to run
I am using both triggers fired/not fired. start with trigger not fired then series of action start with endless loop. then i am using ELSE IF Condition when trigger fired (screen content) then move to next series of actions. as I ask before that it somehow work, but when trigger fired it also repeats the macro from start and continuous repeat until I disable the macro
 

dhj49er

Well-known member
I am using both triggers fired/not fired. start with trigger not fired then series of action start with endless loop. then i am using ELSE IF Condition when trigger fired (screen content) then move to next series of actions. as I ask before that it somehow work, but when trigger fired it also repeats the macro from start and continuous repeat until I disable the macro
When a trigger fires the macro runs from the start.

So if the actions at the start of the macro are not constrained they will run every time any of the triggers fire.

Is it possible to provide a screenshot or your macro?
 

xMaster247

New member
How are you determining when the specific screen content disappears?
I have application, which have login screen with username password. I am using here to ui interaction click text content (Login). in the app. occasionally login successful on first click, otherwise it tooks time, so when login unsuccessful, a pop up message appear. so i am using other click text content (close) with ENDLESS LOOP until login success.
1. So when login text disappear , I want to endloop. OR after login, new text option appear ( like any specific text), I need endloop if appear any text. and move to next action.
 

dhj49er

Well-known member
I have application, which have login screen with username password. I am using here to ui interaction click text content (Login). in the app. occasionally login successful on first click, otherwise it tooks time, so when login unsuccessful, a pop up message appear. so i am using other click text content (close) with ENDLESS LOOP until login success.
1. So when login text disappear , I want to endloop. OR after login, new text option appear ( like any specific text), I need endloop if appear any text. and move to next action.
Have you tried including break loop action in your endless loop with a trigger as a constraint?

Do you have a suitable trigger?

Needs to be when the login text disappears.

Hence my original question how do you detect the disappearing text?
 

xMaster247

New member
When a trigger fires the macro runs from the start.

So if the actions at the start of the macro are not constrained they will run every time any of the triggers fire.

Is it possible to provide a screenshot or your macro?
I understand, when trigger fired, it will start from start. Is any other option available in conditions which act like screen content trigger, so when specific text appear on screen then action endloop work and move to next actions?.
 

xMaster247

New member
Have you tried including break loop action in your endless loop with a trigger as a constraint?

Do you have a suitable trigger?

Needs to be when the login text disappears.

Hence my original question how do you detect the disappearing text?
Yes i use break loop, like for test purpose with airplane mod on/off it works fine. But I want condition for break loop is when screen content appear or disappear then I want break loop work otherwise not (because i have no idea when login screen will successful). as per your original I want when login text disappear breakloop should work (which i need help from this forum) if this is not possible then when after login new screen have new text (if any option which catch the specific text then breakloop).
 

dhj49er

Well-known member
To break the endless loop try using read screen content in the loop.

Find the key that holds login text.

When this key value changes use as constraint for the break loop action.
 

xMaster247

New member
To break the endless loop try using read screen content in the loop.

Find the key that holds login text.

When this key value changes use as constraint for the break loop action.
Thank You for your kind and quick reply. I need your help in this suggestion. as i am using this useful macrodroid app from few days. so i need to understand that how i add this read screen content action in the loop and consttraint.

Note: I am little bitbaware about read screen content action. with the use on this with another macro. I have id that holds login text. need further guidance. can you please share general macro, or if have my macro here can you edit as per your suggestion. Thanks again
 

dhj49er

Well-known member
Thank You for your kind and quick reply. I need your help in this suggestion. as i am using this useful macrodroid app from few days. so i need to understand that how i add this read screen content action in the loop and consttraint.

Note: I am little bitbaware about read screen content action. with the use on this with another macro. I have id that holds login text. need further guidance. can you please share general macro, or if have my macro here can you edit as per your suggestion. Thanks again
Unfortunately I won't be able to edit your macro.
It can only be done on your phone.
I suggest doing it steps.
Add the read screen contents action to the loop. Doing this will create a dictionay variable.
Run the macro - with an initial login failure the endless loop will run, populating the dictionary with keys containing the values of the screen read.
Stop the macro and look at the dictionary contents and find the key with the value login text. Create a string variable to store the value of the selected key.
Use this variable as the break loop constraint. The variable not equal to login text.

Here's an example of the above.
Dictionary is called Screen and is a local variable.
This will contain many keys. Let's say the key with login text is aabbccddee
Create a local steing variable called Login
Set variable login = (lvscreen(aabbccddee))
Break loop C login not equal login text
 

xMaster247

New member
Unfortunately I won't be able to edit your macro.
It can only be done on your phone.
I suggest doing it steps.
Add the read screen contents action to the loop. Doing this will create a dictionay variable.
Run the macro - with an initial login failure the endless loop will run, populating the dictionary with keys containing the values of the screen read.
Stop the macro and look at the dictionary contents and find the key with the value login text. Create a string variable to store the value of the selected key.
Use this variable as the break loop constraint. The variable not equal to login text.

Here's an example of the above.
Dictionary is called Screen and is a local variable.
This will contain many keys. Let's say the key with login text is aabbccddee
Create a local steing variable called Login
Set variable login = (lvscreen(aabbccddee))
Break loop C login not equal login text
Thank You, I'll get back after try
 

xMaster247

New member
Unfortunately I won't be able to edit your macro.
It can only be done on your phone.
I suggest doing it steps.
Add the read screen contents action to the loop. Doing this will create a dictionay variable.
Run the macro - with an initial login failure the endless loop will run, populating the dictionary with keys containing the values of the screen read.
Stop the macro and look at the dictionary contents and find the key with the value login text. Create a string variable to store the value of the selected key.
Use this variable as the break loop constraint. The variable not equal to login text.

Here's an example of the above.
Dictionary is called Screen and is a local variable.
This will contain many keys. Let's say the key with login text is aabbccddee
Create a local steing variable called Login
Set variable login = (lvscreen(aabbccddee))
Break loop C login not equal login text
dear @dhj49er thanks, I tried and it's working. Now I face another problem, as soon as login attempt successful and new screen appear, the app is going disappear from screen (not in foreground). so the next actions are unable to execute. when this happen, whenever I tried manually foreground, app auto going background. when i disable macro, and tried manually foreground and working fine.

Note: few times this problem happen and sometimes not. what's the possible reason, as this is only happen when macro running.
 

dhj49er

Well-known member
dear @dhj49er thanks, I tried and it's working. Now I face another problem, as soon as login attempt successful and new screen appear, the app is going disappear from screen (not in foreground). so the next actions are unable to execute. when this happen, whenever I tried manually foreground, app auto going background. when i disable macro, and tried manually foreground and working fine.

Note: few times this problem happen and sometimes not. what's the possible reason, as this is only happen when macro running.
So it always works when you perform the actions manually with the macro disabled, but not when the macro performs the actions.

Then the macro must to be doing different action(s). I suggest you examine the macro entries in the system log. Go through each action and you should find where the macro doesn't do what you want/expected.
 
Last edited:

xMaster247

New member
So it always works when you perform the actions manually with the macro disabled, but not when the macro performs the actions.

Then the macro must to be doing different action(s). I suggest you examine the macro entries in the system log. Go through each action and you should find where the macro doesn't do what you want/expected.
manually always working, definitely. @dhj49er

it is not working mostly when macro doing actions, rarely it's working fine. why, I don't understand.

specifically when I set day/time trigger for morning and sleep. after wake up and check the result, app is always in background. because of this when i check log of macro, it is still running due to endless loop, but not found/result = false, due to unavailability of app in foreground.

is it possible to force app to foreground always/or when some conditions/text available in screen?
 

dhj49er

Well-known member
manually always working, definitely. @dhj49er

it is not working mostly when macro doing actions, rarely it's working fine. why, I don't understand.

specifically when I set day/time trigger for morning and sleep. after wake up and check the result, app is always in background. because of this when i check log of macro, it is still running due to endless loop, but not found/result = false, due to unavailability of app in foreground.

is it possible to force app to foreground always/or when some conditions/text available in screen?
I don't fully understand your macro as there doesn't seem to be any actions associated with a day/time trigger.

I assume the app goes to the background when you perform the actions manually and presumably you open the app to proceed. Is this correct?

The launch application action (don't select force new) will open the app in the foreground on the last screen.

Whilst that may work, you need to try and find the reason for the app closing and then prevent it.
Eg Another macro running and running a back action.
I'm not familar with the app you are using, so I'm unable to provide help on the app.
 
Top