Script failing even thought action completed successfully

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
tnhall
Newbie
Posts: 5
Joined: Thu Apr 05, 2018 5:34 pm

Script failing even thought action completed successfully

Post by tnhall » Thu May 03, 2018 3:13 pm

Hi -

The below script is failing at "WaitWindowClosed>Communicating with*" even though the "Communicating with *" window has closed. Please provide insight.

Code: Select all

Label>LaunchTapwatch
let>WW_TIMEOUT=60
ExecuteFile>TapwatchLine
WaitWindowOpen>Tapwatch*
let>Lineerror=_LINE_NUM-1
if>WW_Result=FALSE,TapWatchError
wrd>0
wait>1
wwo>Modem Connection*
let>Lineerror=_LINE_NUM-1
if>WW_Result=FALSE,TapWatchError
wrd>0
wait>1
let>WW_TIMEOUT=60
WaitWindowClosed>Modem Connection*
let>Lineerror=_LINE_NUM-1
if>WW_Result=FALSE,TapWatchError
let>WW_TIMEOUT=120
WaitWindowOpen>Communicating with*
let>Lineerror=_LINE_NUM-1
if>WW_Result=FALSE,TapWatchError
let>WW_TIMEOUT=300
WaitWindowClosed>Communicating with*
let>Lineerror=_LINE_NUM-1
if>WW_Result=FALSE,TapWatchError
wait>1
let>WW_TIMEOUT=30

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Script failing even thought action completed successfully

Post by Marcus Tettmar » Fri May 04, 2018 11:37 am

If it is still waiting but the window you think it should notice has closed there are a few possible explanations:

1. There's another window somewhere that matches this title.
2. The window has only been hidden but still exists.

Try telling it to only look at visible windows by adding this line to the top of the code:
Let>WF_TYPE=2

Look under Tools/View System Windows and search for the string to see if there are any other matches. There could be a hidden window for example. Setting WF_TYPE to 2 should prevent it matching any hidden windows.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

tnhall
Newbie
Posts: 5
Joined: Thu Apr 05, 2018 5:34 pm

Re: Script failing even thought action completed successfully

Post by tnhall » Fri May 18, 2018 8:11 pm

I added that line but the issue is still occuring.
Log:
5/18/2018 2:20:54 PM C:\Program Files (x86)\TapWatch2\Files\0450001\0450001 Auto Download.lnk | started
5/18/2018 2:22:23 PM C:\Program Files (x86)\TapWatch2\Files\0450001\0450001 Auto Download.lnk | completed
5/18/2018 2:22:23 PM There was an error running tapwatch at line # 111 for C:\Program Files (x86)\TapWatch2\Files\0450001\0450001 Auto Download.lnk - tapwatch was forcefully terminated

The last line is Line #111

Code: Select all

let>WW_TIMEOUT=60
WaitWindowOpen>Communicating with *
let>Lineerror=_LINE_NUM-1
if>WW_Result=FALSE,TapWatchError
wrd>0
wait>1
let>WF_TYPE=2
let>WW_TIMEOUT=300
WaitWindowClosed>Communicating with *

tnhall
Newbie
Posts: 5
Joined: Thu Apr 05, 2018 5:34 pm

Re: Script failing even thought action completed successfully

Post by tnhall » Fri May 18, 2018 9:23 pm

What I think is happening is that Label:TapWatchError is running after the completion of Label:TapwatchExecuteLog. How do I make a label run on when called upon? Any advise would be greatly appreciated.
2018-05-18_16-20-39.png

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Script failing even thought action completed successfully

Post by Marcus Tettmar » Fri May 18, 2018 10:25 pm

Scripts execute sequentially one line at a time from top to bottom. Labels aren't ignored and don't themselves alter the flow. So yes, the script will get to the first label and continue, executing the code beneath, reach the next label and continue. This is exactly how it is supposed to work.

If you don't want to continue then you could branch away with a Goto. Or perhaps using Labels is not your intention. Perhaps Subroutines and GoSub is more appropriate.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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