Good evening everyone.
Sometimes I tap cancel by mistake and lose the text I was entering or the thing I was doing.
Is there a way to ask for a confirmation when the user press cancel on an input dialog?
I suppose the text that was into the dialog box does not populate the value variable, is there a way to retrieve it?
Thank you.
Tap "cancel" on an input dialog
Moderator: Martin
- tsolignani
- Posts: 187
- Joined: 12 Jan 2019 11:53
- Location: Vignola, Mo, Italy
- Contact:
-
- Posts: 179
- Joined: 16 Oct 2019 17:38
Re: Tap "cancel" on an input dialog
Hello
Cancel seems to lose the input.
You can create a confirmation dialog for the cancel button but the input is still lost.
Hopefully someone might have a workaround.
Good luck
Micky
Cancel seems to lose the input.
You can create a confirmation dialog for the cancel button but the input is still lost.
Hopefully someone might have a workaround.
Good luck
Micky
Crude but it works.
- tsolignani
- Posts: 187
- Joined: 12 Jan 2019 11:53
- Location: Vignola, Mo, Italy
- Contact:
Re: Tap "cancel" on an input dialog
Thank you.
That's the matter, no point in doing a confirmation dialog if the input is lost anyway.
Let's see if someone else has something to say.
Thank you.
That's the matter, no point in doing a confirmation dialog if the input is lost anyway.
Let's see if someone else has something to say.
Thank you.
-
- Posts: 179
- Joined: 16 Oct 2019 17:38
Re: Tap "cancel" on an input dialog
Hello
It's possible.
UI EVENT trigger can watch for Input Dialog WINDOW OPENED. This enables another flow with UI EVENT trigger watching for TEXT CHANGED.
I set it to watch for 1234 being typed and it triggered and returned a variable containing 1234.
This could be written to a text file until you press OK on your Input Dialog.
What I don't know is the Regex or Glob pattern to get it to watch for the whole keyboard.
I don't have time to show you a working example, but here's the bit watching for the 1234. The variable returned is called 'text'
http://automagic4android.com/flow.php?i ... ae536dabb9
Hope this helps
Micky
It's possible.
UI EVENT trigger can watch for Input Dialog WINDOW OPENED. This enables another flow with UI EVENT trigger watching for TEXT CHANGED.
I set it to watch for 1234 being typed and it triggered and returned a variable containing 1234.
This could be written to a text file until you press OK on your Input Dialog.
What I don't know is the Regex or Glob pattern to get it to watch for the whole keyboard.
I don't have time to show you a working example, but here's the bit watching for the 1234. The variable returned is called 'text'
http://automagic4android.com/flow.php?i ... ae536dabb9
Hope this helps
Micky
Crude but it works.
Re: Tap "cancel" on an input dialog
Hi tsolignani
Action input dialog default value as global_a
Action script as example global_a = value;
Condition confirmation dialog as in screen shot
I hope I have explained better
from record4
Action input dialog default value as global_a
Action script as example global_a = value;
Condition confirmation dialog as in screen shot
I hope I have explained better
from record4
- Attachments
-
- Screen shot
- IMG_20200321_112223-1.jpg (81.7 KiB) Viewed 13933 times
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1
Samsung Galaxy j2 non rooted.
Android 5.1.1
Re: Tap "cancel" on an input dialog
It can be done by using Control UI. Put a control UI parallel to the input dialog (so both get executed at the same time). Both input dialog and control UI connected to previous same element.
This CUI script will loop every second and save the text in the input field to the [savedtext} variable. If you accidentally press cancel, you can still use {savedtext} as the output result. Check it using script after the input dialog. The Control UI ends there, not connected to any other element after it.
Code: Select all
sleep(1000);
while(existsElementById("android:id/alertTitle"))
{
savedtext = getTextById("ch.gridvision.ppam.androidautomagic:id/edit_text");
sleep(1000);
}
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
- tsolignani
- Posts: 187
- Joined: 12 Jan 2019 11:53
- Location: Vignola, Mo, Italy
- Contact:
Re: Tap "cancel" on an input dialog
Thank you everybody.
I guess Desmanto solution did the trick.
It works, I put a block with that code and if cancel gets hit by mistake its content get copied to the clipboard.
You could imagine even stricter solutions, like writing the variable to a file maybe, so that you are safe even when the phone crash or does otherwise.
Thanks again, wonderful app and wonderful forum!
I guess Desmanto solution did the trick.
It works, I put a block with that code and if cancel gets hit by mistake its content get copied to the clipboard.
You could imagine even stricter solutions, like writing the variable to a file maybe, so that you are safe even when the phone crash or does otherwise.
Thanks again, wonderful app and wonderful forum!