need help with ini files

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
esuohlluf
Junior Coder
Posts: 41
Joined: Thu Mar 23, 2006 5:33 am

need help with ini files

Post by esuohlluf » Tue Apr 04, 2006 8:29 am

I have never worked with an ini file and do not know how to create one so I tired a test script.
I recall reading on the forum that if the ini file doesn't exist Macro Scheduler will create it.
I created a empty file under program files and called it initest.
Then ran this test script.

EditIniFile>C:\Program Files\initest\myini.ini,usernames,user1,anyname
ReadIniFile>C:\Program Files\initest\myini.ini,usernames,user1,name
message>name

I ran this script several times.
When I run the script I get a message that the ini file does not exist.
Oddly on one occassion it displayed the name 'anyname'.

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

Post by JRL » Tue Apr 04, 2006 1:05 pm

I don't know where you read that editIniFile> will create a file for you but I just tested it and it did not create one for me. However, you can easily create a new file using WriteLn>. The following line will create a new file that contains one blank line.

WriteLn>C:\Program Files\initest\myini.ini,result,

follow that with EditIniFile>

EditIniFile>C:\Program Files\initest\myini.ini,usernames,user1,anyname

and you should find a file C:\Program Files\initest\myini.ini that looks like this if viewed with notepad.

[usernames]
user1=anyname


The rest of your test script should produce a value of "anyname" for the variable "name"

ReadIniFile>C:\Program Files\initest\myini.ini,usernames,user1,name
message>%name%


Hope this is helpful,
Dick

esuohlluf
Junior Coder
Posts: 41
Joined: Thu Mar 23, 2006 5:33 am

Post by esuohlluf » Tue Apr 04, 2006 4:53 pm

Thank you for your help.

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