How can i tell the script to cancel all actions if the user inputs 0 or nothing?
Thanks in advance!!
Label>Start
CapsOff
Let>ASK_TIMEOUT=20000
Ask>Run Script?,VarA
If>%VarA%=YES,IfYes,IfNo
Label>IfYes
Input>number,Enter number runs?,1
Let>x=0
Repeat>x
let>x=x+1
Label>begin
///script
End
input cancellation question
Moderators: Dorian (MJT support), JRL
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
If pressing ESC, the value will be "NO".
If closing the ASK window with the "X", the value will be "NO"
If Timed out (milliseconds) without any action, the value will be "YES"
Try this:
Oops, that was if no action was taken on ASK. I see you are asking about INPUT command, stay tuned.....
If pressing ESC, the value will be blank "".
If closing the INPUT window with the "X", the value will be blank "".
If Timed out (milliseconds) without pressing OK, the value will be blank "", no matter what was typed in.
If clicking on CANCEL, the value will be blank "".
All other actions return the value entered and accepted with the OK button, including the value of "0".
Try this:
After the ASK/INPUT commands, just use an IF statement based on the value returned %vResult%.
If closing the ASK window with the "X", the value will be "NO"
If Timed out (milliseconds) without any action, the value will be "YES"
Try this:
Code: Select all
Let>ASK_TIMEOUT=5000
Ask>Press Escape,vResult
MessageModal>The returned value is %vResult%
If pressing ESC, the value will be blank "".
If closing the INPUT window with the "X", the value will be blank "".
If Timed out (milliseconds) without pressing OK, the value will be blank "", no matter what was typed in.
If clicking on CANCEL, the value will be blank "".
All other actions return the value entered and accepted with the OK button, including the value of "0".
Try this:
Code: Select all
Let>INPUT_TIMEOUT=5000
Input>vResult,Enter number runs?,1
MessageModal>The entry is %vResult%
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Therefore to make the script exit and do nothing if either nothing or 0 is entered, or cancel is pressed::
You may want to extend that to verify the entry further.
Code: Select all
Input>number,Enter number runs?,1
If>{(%number%="") OR (%number%="0")}
Exit>0
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?