OnEvent when script fail

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ruanseb
Newbie
Posts: 5
Joined: Fri Dec 01, 2017 9:37 pm

OnEvent when script fail

Post by ruanseb » Thu Jan 18, 2018 4:14 pm

Its possible use onevent to do x action when script fail to detect a window or a label, etc?
fail.png
Like this message when fail to find a window in setfocus "information window"

Code: Select all

OnEvent>WINDOW_OPEN,Information,,
SRT>Alarm

PlayWav>C:\Users\Public\Music\Sample Music\Sleep Away.mp3

END>Alarm

setfocus>testing


label>1
wait>1
goto>1
Trying make it play a wav when my script pop up any error msg. :!:

ruanseb
Newbie
Posts: 5
Joined: Fri Dec 01, 2017 9:37 pm

Re: OnEvent when script fail

Post by ruanseb » Fri Jan 19, 2018 1:49 pm

Any help? :(

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: OnEvent when script fail

Post by JRL » Fri Jan 19, 2018 3:21 pm

When the information window pops up the script stops. Therefore the OnEvent is not executed. The only way I know to do what you ask is to have a second script that detects the information window. Be sure to provide a method to stop the second script


Code: Select all

DeleteFile>%temp_dir%InformationWindowDetection.scp
LabelToVar>Script,vData
WriteLn>%temp_dir%InformationWindowDetection.scp,wres,vData
ExecuteFile>%temp_dir%InformationWindowDetection.scp
Wait>1

setfocus>testing
label>1
wait>1
goto>1

/*
Script:
OnEvent>WINDOW_OPEN,Information,,Alarm
SRT>Alarm
PlayWav>C:\Users\Public\Music\Sample Music\Sleep Away.mp3
Exit>0
END>Alarm

label>2
wait>1
goto>2
*/

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts