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.
Debugger not resolving %SCRIPT_DIR% correctly
Moderators: Dorian (MJT support), JRL
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
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?
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!
Bob
A humble man and PROUD of it!
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
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