Does ReadiniFile look in a specific windows directory? Maybe I just confused myself, but it appears to me that IfFileExists> will look for the file in the current directory if there is no path specified, but ReadIniFile> doesn't default to the current directory.
So this code finds the .ini exists, but doesn't read it:
IfFileExists>myini.ini,start,nofile
Label>nofile
MessageModal>INI File Missing
Goto>theend
Label>start
MessageModal>this is start
ReadIniFile>myini.ini,data,outfile,outfile
.
.
.
Label>theend
If I hard code the path for the .ini it works fine. I'm compiling the macro and running it in its home directory in a cmd window.
ReadIniFile default directory ?
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Both take a file name so will work with the current directory and a full path.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
But that's not my experience, and I double checked on another PC today. If I compile this:mtettmar wrote:Both take a file name so will work with the current directory and a full path.
ReadIniFile>c:\ftps\myini.ini,settings,user,username
Let>msg=The Username is
ConCat>msg, %username%
MessageModal>msg
and copy it and the .ini to c:\ftps it works. If I change the ReadIniFile line to:
ReadIniFile>myini.ini,settings,user,username
compile and put it in the c:\ftps directory it doesn't find the .ini. I'm trying to create a compiled program that will work in any directory, what am I doing wrong?
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
In that case use %SCRIPT_DIR% which is always set to the directory of the running script or executable:Me_again wrote:I'm trying to create a compiled program that will work in any directory, what am I doing wrong?
ReadIniFile>%SCRIPT_DIR%\myini.ini,data,outfile,oufile
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?