Scripts Cannot find Labels/Sub-routines in Some Situations

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
cwalter
Newbie
Posts: 5
Joined: Wed Jun 25, 2003 6:12 am

Scripts Cannot find Labels/Sub-routines in Some Situations

Post by cwalter » Sat Jun 28, 2003 1:28 am

Macro Scheduler Pro 7.2.036
Operating system is Windows 2000.

Problem Encountered
-------------------

I have had some problems with scripts that include labels and with scripts that include sub-routines calls.

I get errors such as:

1.
Error – Label truelabel1 Not Found

The problem was for an ‘if’ – ‘label’ condition present in a subroutine (The subrountine was declared at the top of the macro). When the same code was taken out of the subroutine and run in the main code body then the truelabel1 label was found okay. The ‘if’ – ‘label’ code was:

//Testing condition where yesterday's files are sent when current time is between 00:00 and 01:30 hours in the morning.
//NOTE: Hour function returns hh24 (e.g. 00, 01, .. 23), and Min function returns mi format (e.g. 00, 01, 02 .. 59)
Let>cur_hour=02
Let>cur_min=00
If>cur_hour>01,truelabel1

If>cur_hour=00,truelabel2

//If here the cur_hour = 01 so check the minutes.
If>cur_mintruelabel2

MessageModal>Are in 00:00 -> 01:30 range

Label>truelabel1


2.
Error – Subroutine ExtractFiles Not Found

The ExtractFiles subroutine is declared at the top of the macro and when called in some places in the script is found, but when called in other places (e.g. between an ‘if’ - ‘label’ condition) is not.

I am curious about whether there are any known problems with macro code finding labels and subroutines? Are these more prevalent when when the amount of macro code gets more substantial?

Are there any workarounds?

Thanks,

Craig Walter.

Lumumba

Post by Lumumba » Sat Jun 28, 2003 6:02 am

In my MSched the [,false_label_name] option didn't work properly.
So I've replaced

Code: Select all

If>cur_min<31,truelabel2,truelabel1
with that

Code: Select all

If>cur_min<31,truelabel2
Goto>truelabel1
Have a try ...

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Jun 28, 2003 1:00 pm

Hi Craig,
(The subrountine was declared at the top of the macro).

Could you kindly show us how a subroutine can be decalared in a Macro Scheduler script?

If your sample code is inside a subroutine while either truelable1 and/or truelable2 are labels outside the subroutine, I'm not sure if Macro Scheduler supports such jump-to programming style.

One thing for sure, Macro Scheduler loosely allows mulitple instances of the same label. That's, you can have, say, 100, instances of Label>truelabel1 in the same script file, but goto> always jumps to the nearest one downward. That's, Macro Scheduler won't jump to the top of the script and scan for the first matching label.

cwalter
Newbie
Posts: 5
Joined: Wed Jun 25, 2003 6:12 am

Post by cwalter » Tue Jul 01, 2003 5:20 am

Hi Armstrong,

My Reply
----------

I stated : (The subrountine was declared at the top of the macro).

Probably should have stated that the subroutine was defined at the top of the macro. A skeleton of the code is below.

//// Local Subroutines Below ////

// Subroutine to present mouseclicks/keystrokes to extract appropriate files.
SRT>ExtractFiles

// Click on OK button.
LClick
Wait>0.16
MouseMove>196,89
Wait>15.55

// etc.
// etc.

End>ExtractFiles



// Main

// etc

//Click to set the start day to the current day.
LClick
Wait>0.15
MouseMove>186,96
Wait>4.01

// Subroutine to present mouseclicks/keystrokes to extract today's files -
// when the FContext is 2
Gosub>ExtractFiles

// etc.


Cheers,

Craig.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Tue Jul 01, 2003 9:31 am

Hi Craig,

Thanks for including a skeleton script so that forum members can continue fruitful troubleshoting.
...when called in other places
was mentioned in your last post, but I can identify it in your script. Neither is your goto>truelable1 issue.

Craig, speaking from my personal experience, I haven't encountered any major issues in general and gosub/goto in particular.

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