Marcus' Macro Blog

Mostly tips, tutorials, articles and news about Macro Scheduler & Windows Automation
May 12th, 2009 by Marcus Tettmar

An experienced Macro Scheduler scripter was recently trying to figure out why the following code wasn’t doing what he expected:

If>seg_1=05
  Let>monLtr=mm
Endif

Apparantly monLtr was always being set to 05.  This told me that “mm” must have been a variable which had earlier been set to 05.   But my friend said “I’ve looked all through the code I can’t see where “mm” is set anywhere”.  

Then I reminded him of the Variable Explorer.  ”The what?” he asked.

varexplorerUnder the editor select Tools/Variable Explorer or hit Ctrl-Alt-V and you’ll get a box like this one.  It shows a list of all the variables created by your script.  

Bingo!  There’s mm.  Expand it and you’ll see all the lines where it is set/created.   In this case it’s created on line 40 by the Min command.  

In a long script it’s easy not to see the obvious.  The Variable Explorer makes it easier.

Of course, it would also be sensible to use a better naming convention for the variable to avoid such confusion.  Or use VAREXPLICIT or he could have used {”mm”} to specify the literal string value.   But don’t forget the Variable Explorer as it can save a lot of hunting around.

[Post to Twitter] Tweet This

Related posts:

  1. Using Variables and When to use Percent Symbols (%variable%)
  2. Attaching to an existing Internet Explorer instance
  3. FTP Uploader – Upload Files From Explorer
  4. Use the Debugger!
  5. Reading through text files in memory

Leave a Reply