How to use ReadIniFile with a relative path?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

How to use ReadIniFile with a relative path?

Post by rullbandspelare » Wed Sep 20, 2006 5:08 am

Hi!
When i use
ReadIniFile>.\modalitet\I80914,worklist,AET,VAET
I get Inifile in Readinifile does not exist.
My 7.3 compiled inireader.exe is in the same folder as the folder named modalitet containig the I80914 ini file.
Using a Absolute Path(c:\tjo\modalitet\I80914) works. But I whant to have a relative.
Thanks!

hvdberg
Junior Coder
Posts: 39
Joined: Wed Jul 12, 2006 1:50 pm
Location: Netherlands

Post by hvdberg » Wed Sep 20, 2006 6:59 am

Hi,

The help gives an example where the .ini extension is explicitly part of the readinifile command. Your code doesn't contain .ini in the command. Try adding that and see if it works.

Best,
Henk

rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Post by rullbandspelare » Wed Sep 20, 2006 8:57 am

Thanks for the reply, But it was me who had missed that the .scp uses the
C:\Program Files\MJT Net Ltd\Macro Scheduler as a path and not the folder where the .scp is started from.
I got lost in the debugging.

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

Post by Marcus Tettmar » Wed Sep 20, 2006 9:37 am

If I were you I'd get the current path with CWD - the current working directory could change depending on what else the script has done, or whether the script is being run from Macro Scheduler or as an executable. Use the built-in CWD variable.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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

Post by JRL » Wed Sep 20, 2006 1:34 pm

Also, since it was mentioned by Henk, the file name for an INI file used by ReadIniFile> is not an issue. The name can be any valid file name. See this thread for a more complete explanation. Particularly, Bob Hansen's second post.

Later,
Dick

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Sep 20, 2006 1:52 pm

Maybe using %SCRIPT_DIR%\myinifile.ini would help?

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

Post by Marcus Tettmar » Wed Sep 20, 2006 1:53 pm

Yes, SCRIPT_DIR should be used where the INI file is always in the same folder as the script.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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