Sign in to follow this  
Followers 0
PatL

Error Handling When value out of range is entered

5 posts in this topic

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



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

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

#4 ·  Posted (edited)

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

Thanks. That will solve it

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  
Followers 0