Include> not working the same between opened files

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
mafiamoe
Junior Coder
Posts: 38
Joined: Thu Jul 06, 2006 8:28 am

Include> not working the same between opened files

Post by mafiamoe » Thu Feb 12, 2009 7:51 am

Include>code.scp works for when running the script, editing the script after opening it from a folder, but NOT when editing the script after opening it in the Macro Scheduler window.

My guess is the Script_Dir is saved as a special variable for the Include function, but this variable isn't being set correctly when opening a file to edit from the Macro Scheduler window. Just a guess.

I am running 11.1.03 (latest release) but didn't notice any patch notes about the Include getting any changes/fixes. Running Windows 7 64-bit beta.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Include> not working the same between opened files

Post by Marcus Tettmar » Thu Feb 12, 2009 10:29 am

mafiamoe wrote:Include>code.scp works for when running the script, editing the script after opening it from a folder, but NOT when editing the script after opening it in the Macro Scheduler window.
Not sure if you wrote that down correctly here, but you have missed out the path. Without a path Macro Scheduler would have to look in the current working directory (CWD) which could be anywhere. CWD may change depending on what you are doing.

Always specify a full path. Alternatively use %SCRIPT_DIR% if you are referring to a file in the same folder as the current script. However, bear in mind that if you haven't yet saved the script SCRIPT_DIR is nothing! So save the script first.

When compiling, if you want the include to be sucked into the compiled EXE then you either need full paths or SCRIPT_DIR. While any other variable will work when RUNNING the script it is meaningless at compile time so cannot be used to compile the includes statically.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mafiamoe
Junior Coder
Posts: 38
Joined: Thu Jul 06, 2006 8:28 am

Post by mafiamoe » Thu Feb 12, 2009 11:21 am

I see how it works, but having a variable in Include, such as Include>%Script_Dir%\code.scp currently doesn't work even when stepping. Not sure if this is intentional or not.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Feb 12, 2009 11:29 am

It works for me.

But it should be SCRIPT_DIR - upper case:

Include>%SCRIPT_DIR%\script.scp
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mafiamoe
Junior Coder
Posts: 38
Joined: Thu Jul 06, 2006 8:28 am

Post by mafiamoe » Thu Feb 12, 2009 11:38 am

Ah, Include is case sensitive. Thank You.

After trying to manipulate CWD to work, I found that when opening a script through the Macro Scheduler window it tends to reset the CWD variable when stepping every time it encounters some code, however it doesn't do this when stepping after opening the script through the folder.

This waste of time may turn out to be not such a waste of time after all, but you could prove me wrong... again...

mafiamoe
Junior Coder
Posts: 38
Joined: Thu Jul 06, 2006 8:28 am

Post by mafiamoe » Fri Feb 13, 2009 12:05 am

When editing a file after opening it from a folder, the Include>%SCRIPT_DIR%/script.scp doesn't seem to be working. Gives the 'file in include does not exist' error.

It does work when opening the file from the Macro Scheduler window.

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