Can you use a goto command when the label is above the goto?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Guest

Can you use a goto command when the label is above the goto?

Post by Guest » Mon Oct 20, 2003 9:47 pm

I want to create a looping structure. Here is some sample code:

label>start
code...
code...
if>a=b,next,finish
label>next
code...
code...
goto>start
label>finish

Would this work? So if a=b, then it will continue on and eventually go back up to the start label. I'm doing this now and it is very inconsistent. It either loops withoutending, but doesn't execute the code inside the labels, or it just stops executing. I can't figure it out.

Any ideas?

Thanks.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Oct 20, 2003 10:05 pm

Basic loop looks OK. You can go to a Label that is higher/earlier in the script. (If you have duplicate Labels, program will go to first one it finds reading down from the beginning).

Check that where you are referring to "a" and "b" that you do not have any extra space characters before or after "a" or "b" (Quotes are here for clarification only,not used in actual script. " a" and "a " are not the same as "a". Same thing with "b" and any other variables.

Variables are also Case Sensitive, be sure you are consistent.

May also need "a" and/or "b" to be referenced as %a% or %b%.

Bigger example of actual code would be helpful here to assist you.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

Post by armsys » Mon Oct 20, 2003 11:28 pm

Hi Guest,

Your skeleton script looks okay.
To expedite your troubleshooting effort, you may use the debugging tool built inside the editor. Just make sure you set "Show Watch List" on. Then press F8 to execute line by line and watch the changes of a and b.

Happy scripting.

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