Debugger not resolving %SCRIPT_DIR% correctly

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Debugger not resolving %SCRIPT_DIR% correctly

Post by adroege » Wed May 18, 2005 1:35 pm

Version 7.3.11.3 Pro

I use the %SCRIPT_DIR% variable extensively when calling external macros, i.e.

Macro>%SCRIPT_DIR%\Open Security.scp

And this works fine. The problem occurs when I try to step through the code using F8.
When it gets to this line I get the error message:
"Macro, C:\Program Files\MJT Net Ltd\Macro Scheduler\Open Security.scp, specified in Macro> command Does Not Exist"

So this means the %SCRIPT_DIR% variable is resolving incorrectly in this case. I have these
macros in a subdirectory off the main macro scheduler directory....i.e
C:\Program Files\MJT Net Ltd\Macro Scheduler\Financials

Per the on-line help "%SCRIPT_DIR% is the Directory of running script".

Like I said before, simply running the macro it works, Debugger it does not.

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed May 18, 2005 1:45 pm

Just a thought. Spaces in file names and directory names are sometimes a problem. Does it work correctly if you rename the file:

Open_Security.scp

Hope this was helpful,
Dick

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Wed May 18, 2005 2:02 pm

See the error message does not even reference the RIGHT DIRECTORY? It is not a matter of not recognizing the script name.

When it gets to this line I get the error message:

"Macro, C:\Program Files\MJT Net Ltd\Macro Scheduler\Open Security.scp, specified in Macro> command Does Not Exist"

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 » Wed May 18, 2005 2:29 pm

I think that I see a space character after macro, and before C:\......
Remove that space character.

Oops...never mind, that is in the message, not in the script.

--------------------------------
Recap:
1. You start Macro Scheduler in Macro Scheduler folder.

2. The first script "A" you open is in \Macro Scheduler\ folder.
When single stepping %Script_Dir% is OK.

3. Macro "A" calls a macro script "B" from folder \Macro Scheduler\Financials\.

4. When continuing to single step, %Script_Dir% still references the original folder \Macro Scheduler\ with "A", does not change to the folder \Macro Scheduler\Financials\ where "B" is located?

Have I stated this correctly?

-------------
What if you insert a BreakLine in Script "B". Load Script "A" and run in Diagnosis mode with WatchList open? What is value of %Script_Dir% then, when it halts at BreakLine?
Last edited by Bob Hansen on Wed May 18, 2005 2:43 pm, edited 2 times in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed May 18, 2005 2:35 pm

Sorry, I guess I didn't read your initial post carefully enough.

When you are running the macro in the editor what does the Watch List tell you the value is for "SCRIPT_DIR"? If it tells you you are currently in the "Finacials" directory then I think only support can help you. If it says you are in the "Macro Scheduler" directory, then maybe you could resolve this by using the "Change Directory" command and changing the current directory to "financials".

However, I see your point., the help information clearly states that the variable "SCRIPT_DIR" is the "Directory of running script". My fear is that when you are in the editor, you are not really in the running script, you are running the editor.

Edit1

I was just looking at the provided variables and playing around with a directory within my "Macro Scheduler" directory. I see that even going to Windows Explorer and involking the editor on a macro that is located in a sub directory leaves you in the "Macro Scheduler" directory when looking at the SCRIPT_DIR variable.

I did notice that there is another variable "COMMAND_LINE". It has the following value:

"C:\Program Files\MJT Net Ltd\Macro Scheduler\msched.exe" -EDITOR C:\Program Files\MJT Net Ltd\Macro Scheduler\financials\test1.scp

As you can see the last part of this variable is the macro's residence and the first part is the editor's residence.

I'm convinced that the problem is that when you are in the editor you are seeing the editors directory and not the macros directory.

Hope this was helpful,
Dick

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