Text display action

Post your questions and help other users.

Moderator: Martin

Post Reply
TheUnknownBuffalo
Posts: 38
Joined: 09 Aug 2017 07:19

Text display action

Post by TheUnknownBuffalo » 22 Aug 2017 19:49

Hi all

Is it possible for AM to action based on monitoring text displayed within an app?

As in, say an app displays text 'you won a prize' in the middle of the screen but it isn't a button or a dialog box?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Text display action

Post by Desmanto » 23 Aug 2017 05:08

It can probably done using the same solution to your previous question.
http://automagic4android.com/forum/view ... f=5&t=6854

But I think in this case you mean the toast message, white text on gray background. If that so, you can use trigger : Notification on Screen Displayed.
Package Name : *
Text Filter : contains text :
(text filter is blank, no need to fill anything)

Single asterisk (*), means it matches all apps. If you want only in selected app, select your app in the package name field, you can choose several at once.

Then you can choose what to do with the toast message. I use this to catch all toast message from all apps and log it to file for further research.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

TheUnknownBuffalo
Posts: 38
Joined: 09 Aug 2017 07:19

Re: Text display action

Post by TheUnknownBuffalo » 24 Aug 2017 09:42

Ops sorry, was on holiday and din't realise I double posted!

I've used the overlay function to find the text object, and now have a:

text = getText("Congratulations*");

and have added it to a trigger of a UI announcement:

event type: accouncement
package name: *
text, contains text: Congratulations

then I have it follow through with a notification on screen: test to check that it works

When I run it through AM, it displays 'test' straight away, so I enable the workflow, yet it doesn't work. Do I need to add some kind of condition when text displayed for it to run?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Text display action

Post by Desmanto » 24 Aug 2017 13:34

Show Overlay Control from Action Control UI is different compared to Recent Events from Trigger UI Event. One is for action, executing something; while the trigger is detecting UI Event. You should open trigger UI Event, leave that open, go to the app; do not use show overlay. Just like the instruction in the thread before. Automagic will automagically fill the value for you. You just need to select the correct recent event.

If you can select the the element, means it is not toast message. It is correct already to use trigger : UI event, to detect it. Manual execution from AM will always run all your action/condition without actually get triggered by the real event. It is for testing the action/condition, not the trigger.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

TheUnknownBuffalo
Posts: 38
Joined: 09 Aug 2017 07:19

Re: Text display action

Post by TheUnknownBuffalo » 24 Aug 2017 18:03

hmm when I do that, I can't see anything about recent events in the trigger, here should I be looking?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Text display action

Post by Desmanto » 25 Aug 2017 01:10

Can you show me the screenshot when the "Congratulations ..." appear? I am confused now whether it is toast message or element at the UI. What is the color of the message? White text on gray box? Or some other color?

If it is toast message, then my answer in 2nd post can catch it. If it is element, then 4th post or previous thread can catch it.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply