Jump to content
Sign in to follow this  
PatL

Error Handling When value out of range is entered

Recommended Posts

PatL

When running the script to modify an application's settings in a dialogue box and the script tries to enter a value that is out of range, the application comes up with a dialogue box saying it need to adjust the setting to put in in acceptable range. I click the OK box in the dialogue box to proceed and the script locks up the computer.

Is there a way to detect the condition and handle it to avoid the lock up?

Thanks

Share this post


Link to post
Share on other sites
amokoura

You could use some winwaitclose() to check when the dialog disappears and then proceed code execution. Maybe that way you could avoid the script going to an unknown state.

Share this post


Link to post
Share on other sites
PatL

I am not sure how to apply winwaitclose() ....I am rather new. Can you suggest some code segment? The dialogue box only shows up on occasion (i.e. when the user puts in an entry out of range).

Thanks

Share this post


Link to post
Share on other sites
amokoura

Allright if the dialog pops up sometimes maybe this is suitable

; ...
; Some code here that might pop up the dialog
; ...

; Wait 2 seconds for dialog box
if winwait("dialog title", "", 2) then
  
 ; Use "y" for "Yes" or whatever closes the dialog ({Enter} maybe?)
  Send("y")

  ; Give some time for closing. Use WinWaitClose if you want to be precise
  Sleep(250)

endif

; ...
; The code will continue here regardless of the dialog box
; ...
Edited by amokoura

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.