Click and store text

Post your questions and help other users.

Moderator: Martin

Post Reply
Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Click and store text

Post by Ankit » 05 Aug 2015 06:20

Hi,
I want to click OK Button as soon as this popup is displayed after every call or data usage and also want to store this text in an file (Just like Balance Update / USSD blocker by Sriram Melkote Tools app available in the Google Play Store)........
Please Help!!
Attachments
Screenshot_2015-08-05-11-39-34.jpg
Screenshot_2015-08-05-11-39-34.jpg (410.36 KiB) Viewed 14069 times

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Click and store text

Post by Martin » 05 Aug 2015 19:29

Hi,

You could use trigger UI Event to detect this window and then use Control UI with functions text = getText(x, y); to extract the text and click("OK"); to dismiss the dialog (function back(); might also work).

Regards,
Martin

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Re: Click and store text

Post by Ankit » 06 Aug 2015 01:58

Hi Martin
What will be the event type and package name in control UI ??

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Click and store text

Post by Martin » 06 Aug 2015 19:20

Hi,

Hard to say, maybe com.android.systemui but I'm really not sure.
You could use trigger UI Event and set the package to * to react to all packages and then check the log of Automagic.

I would not use condition Debug Dialog in this particular case since it could lead to some kind of endless loop when showing the Debug Dialog also triggers the flow again.

Regards,
Martin

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Re: Click and store text

Post by Ankit » 08 Aug 2015 02:44

Hi,
I have been able to trigger the flow when the popup is displayed but it is also triggering the flow when the phone call is connected after making the phone call
http://automagic4android.com/flow.php?i ... e9c6b1908a

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Click and store text

Post by Martin » 08 Aug 2015 15:35

Hi,

You could either change the trigger to match the contents of the dialog by setting the type to matches glob with *Session Cost* (only works when the UI event contains the whole text and not just the title).
You could also execute the action Control UI and check if the extracted text contains the pattern you like. You can do this with a condition Expression: contains(text, "Session Cost");. You also have to change the action Control UI to use the actual coordinates of the text field instead of variables x and y.

Regards,
Martin

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Re: Click and store text

Post by Ankit » 14 Aug 2015 06:50

Hi Martin
When I changed contains text to matches glob, it is not triggering the flow.......
http://automagic4android.com/flow.php?i ... 259f038e97

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Click and store text

Post by Martin » 14 Aug 2015 18:12

Hi,

Did contains text work? Can you enable the flow, display the dialog and check what's in the log? I assume that the variable text in this case only contains the title Phone but not the content of the entire dialog.
If this is the case, you could set contains text to Phone and then query the text with action Control UI: dialog_text = getText(200, 650); to extract and then check the text with Expression: contains(dialog_text, "Session Cost");.
You can find the real coordinates of the text either with Control UI/Show Overlay Control or by enabling System settings->Developer options->Pointer location.

Regards,
Martin

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Re: Click and store text

Post by Ankit » 16 Aug 2015 13:00


Post Reply