Problem with SkipLabel> command

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Problem with SkipLabel> command

Post by bnc1 » Wed Jun 23, 2010 2:20 pm

I am having problems with Onevent and Skiplabel commands :

Code: Select all

OnEvent>WINDOW_NEWACTIVE,0,0,NewWin

let>j=0
label>restart
let>dummy=
let>j=j+1
wait>0.2
if>j>50
  mdl>time out
  exit>0
  endif
goto>restart

label>end_macro
mdl>%NewWin_title% ended
exit>0

Srt>NewWin
  GetActiveWindow>NewWin_title,xpos,ypos
  Let>pattern=Internet Explorer
  regex>pattern,%NewWin_title%,1,matches,num,0
  if>Num=1
    gosub>Autolog
    endif
END>NewWin

SRT>Autolog
   mdl>Autolog
   wait>1
   ifwindowopen>%NewWin_title%
     closewindow>%NewWin_title%
     endif
   skiplabel>end_macro
End>Autolog

If I run the above script and then open or switch to an Internet Explorer window, the NewWin subroutine and Autolog subroutines get executed as expected. However the last command in the Autolog SRT, SkipLabel>, does not pass control to label>end_macro as it should ???

If I move the 3 lines of code starting with label>end_macro to the bottom of the script, after the End>Autolog command, then the SkipLabel> command is excuted properly ?! :!:

My setup: Windows 7 Pro x64, Macro Scheduler 12.0.3

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Post by gdyvig » Wed Jun 23, 2010 3:11 pm

Hi bnc1,


The problem is with the nested SRTs. The SRT finishes up before skipping to the label. But should both SRTs finish up.

Move the SkipLabel to the higher level SRT:

Code: Select all

Srt>NewWin
  GetActiveWindow>NewWin_title,xpos,ypos
  Let>pattern=Internet Explorer
  regex>pattern,%NewWin_title%,1,matches,num,0
  if>Num=1
    gosub>Autolog
    skiplabel>end_macro
  endif
END>NewWin

SRT>Autolog
   mdl>Autolog
   wait>1
   ifwindowopen>%NewWin_title%
     closewindow>%NewWin_title%
   endif
End>Autolog

Gale

bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Post by bnc1 » Thu Jun 24, 2010 5:34 am

Thanks Gale :D . Moving the SkipLabel command seems to work. I still think there might be a MS bug here :wink: since moving the end_macro code also "fixes" the problem as mentioned in my original post.

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