EditIniFile Question / Query

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
melb.robmac
Newbie
Posts: 12
Joined: Tue Jun 17, 2008 12:12 am
Location: Melbourne Australia
Contact:

EditIniFile Question / Query

Post by melb.robmac » Wed Oct 15, 2008 2:19 am

I am using the EditIniFile function to write details to an ini file for later use. However, it appears that even though the script states that it is writing the details to the ini file, and has the ability to read the information back again, if I open the ini file up, the details HAVE NOT been written.
Is there an known issues along these lines and what can I do about it to ensure that the file is actually being written to successfully?
Any other suggestions are greatly appreciated too.
Thanks,
Rob - Melbourne Australia

melb.robmac
Newbie
Posts: 12
Joined: Tue Jun 17, 2008 12:12 am
Location: Melbourne Australia
Contact:

EditIniFile Question / Query - More information

Post by melb.robmac » Wed Oct 15, 2008 2:39 am

Hi agian,
Further to this, I deleted the contents of each ini file setting to see what would happen (I had been writing three different settings in the one ini file).
However, when I ran the script again, only TWO of the items were updated EVEN THOUGH when I read the ini file contents, it said that all three were read ... I even displayed these in a MDL box.
Thanks,
Rob - Melbourne Australia

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Oct 15, 2008 3:59 am

1. I believe that the INI file must exist before it can be written to, so make sure you have an INI file before you use EditIniFile.

2. I also think that the INI file contents are Case Sensitive, so be sure that the Section and Entry values ore consistently using idendical Case and spelling.

2. Can you please provide the code you are using. There is no way for us to model/simulate your problem without seeing the code you are using.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

melb.robmac
Newbie
Posts: 12
Joined: Tue Jun 17, 2008 12:12 am
Location: Melbourne Australia
Contact:

EditIniFile Question / Query

Post by melb.robmac » Wed Oct 15, 2008 4:58 am

Bob,
Thanks for the reply ... The file does already exist and I have gone over the script again to check that it is using the correct tags in the INI file - without success.
Here is a short excerpt from the script:

//make sure that if first name is below 10 then middle needs to be below 5
IF>Lgendselect=2
Let>LGender=5
IF>%lnot_fnselect%LGender=5
Random>%lnot_imname_count%,Lnot_mnselect
IF>lnot_mnselect>5
Let>middle=5
repeat>lnot_mnselect
Random>%middle%,lnot_mnselect
until>lnot_mnselect%lnot_fnselect%>9
//make sure that if first name is above 9 then middle needs to be above 5
Let>LGender=5
Random>%lnot_imname_count%,Lnot_mnselect
IF>lnot_mnselectmiddle=Lnot_imname_count
repeat>lnot_mnselect
Random>%middle%,lnot_mnselect
until>lnot_mnselect>5
ENDIF
ENDIF
IF>lnot_mnselect=0
let>lnot_mnselect=lnot_mnselect+1
ENDIF
EditIniFile>%iniloc%%inifile%,NewPatient,gender,LGender
EditIniFile>%iniloc%%inifile%,NewPatient,first,lnot_ifname_%lnot_fnselect%
EditIniFile>%iniloc%%inifile%,NewPatient,middle,lnot_imname_%lnot_mnselect%
EditIniFile>%iniloc%%inifile%,NewPatient,last,l_isurname_%l_isurnameselect%


Outside of this excerpt, the script randomly selects a first name, middle name and surname (amongst other things) and then selects the title as well as the gender. I realise that it's a bit "odd" but this enables me to ensure a reasonable set of test data for the regression suite I'm "attempting" to build.
Thanks again.
PS. When I wrote the email it WAS all aligned nicely to meet normal coding standards (the coding standards that I used to use years ago at least).
Rob
Melbourne, Australia

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

Post by Marcus Tettmar » Wed Oct 15, 2008 8:08 am

I think you must be looking at a different copy of the ini file! If the script has written to it and the read from it then it must have been written!

Add this after your EditIniFile calls:

Run>notepad.exe "%iniloc%%inifile%"

Then we can see what is in the ini file and be sure it's the same one. Be interesting also to see what iniloc and inifile are set to.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

melb.robmac
Newbie
Posts: 12
Joined: Tue Jun 17, 2008 12:12 am
Location: Melbourne Australia
Contact:

EditIniFile Question / Query

Post by melb.robmac » Wed Oct 15, 2008 11:50 pm

Marcus,
The contents of the two variables is as follows:

Let>iniloc=c:\program files\macro scheduler\gh\ini\
Let>Inifile=ePAS.ini

Interesting that you suggested something that I suspect - only problem is that I've done a search for the ini file and couldn't find any duplicates ... so I'm quite confused about it.

I shall however try to open up notepad for the ini file based on the variables and see what happens.
Thanks.
Rob
Melbourne, Australia

melb.robmac
Newbie
Posts: 12
Joined: Tue Jun 17, 2008 12:12 am
Location: Melbourne Australia
Contact:

EditIniFile Question / Query

Post by melb.robmac » Thu Oct 16, 2008 12:14 am

Marcus,
Further to my previous post - I have tried what you suggested and the ini file brings up the ini file that I was looking at - no middle name.
However, I'm also using the MDL> command and it brings up the middle name ...
Therefore I'm still confused about this one.
I will keep trying and let you know what I find (if anything).
Thanks.
Rob
Melbourne, Australia

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Oct 16, 2008 1:53 am

Cannot test it right now, but this line does not look valid:

until>lnot_mnselect%lnot_fnselect%>9
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

melb.robmac
Newbie
Posts: 12
Joined: Tue Jun 17, 2008 12:12 am
Location: Melbourne Australia
Contact:

EditIniFile Question / Query

Post by melb.robmac » Thu Oct 16, 2008 2:23 am

Hi Bob,
Interesting - that you should point that out ... Hmmm I'll have a look and let you know ... I don't think that it copied very well originally ... this is what it SHOULD look like ...
-----
IF>Lgendselect=2
//make sure that if first name is below 10 then middle needs to be below 5
Let>LGender=5
IF>%lnot_fnselect%LGender=5
Random>%lnot_imname_count%,Lnot_mnselect
IF>lnot_mnselect>5
Let>middle=5
repeat>lnot_mnselect
Random>%middle%,lnot_mnselect
until>lnot_mnselect%lnot_fnselect%>9
//make sure that if first name is above 9 then middle needs to be above 5
Let>LGender=5
Random>%lnot_imname_count%,Lnot_mnselect
//Let>Lnot_mnselect=4
IF>lnot_mnselectmiddle=Lnot_imname_count
repeat>lnot_mnselect
Random>%middle%,lnot_mnselect
until>lnot_mnselect>5
ENDIF
ENDIF
...
...
...
ENDIF

-----
Thanks.
Rob
Melbourne, Australia

melb.robmac
Newbie
Posts: 12
Joined: Tue Jun 17, 2008 12:12 am
Location: Melbourne Australia
Contact:

EditIniFile Question / Query

Post by melb.robmac » Fri Oct 17, 2008 1:21 am

Hi everyone,
I've fixed it!!
The problem was that I was using a variable in a script that was the same name as an entry name in the INI file.
My Fault entirely!
Thanks.
Rob
Melbourne, Australia

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