Reading ini files issues

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Novalak
Newbie
Posts: 9
Joined: Sun Dec 07, 2014 10:23 am

Reading ini files issues

Post by Novalak » Sun Dec 07, 2014 9:50 pm

ReadIniFile>c:\Upload\test.ini,Testing,user,username
Let>name=username


test.ini looks like the following

[Testing]
user=Novalak


nothing in the code watch list, is blank name is not being populated

Am i doing something wrong

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

Re: Reading ini files issues

Post by Marcus Tettmar » Mon Dec 08, 2014 9:06 am

Is "user" a literal or might it already be a variable? What happens if you do:

ReadIniFile>c:\Upload\test.ini,{"Testing"},{"user"},username

Or better would be a more obvious variable name which is not going to get confused with something else:

ReadIniFile>c:\Upload\test.ini,{"Testing"},{"user"},strUserName
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Novalak
Newbie
Posts: 9
Joined: Sun Dec 07, 2014 10:23 am

Re: Reading ini files issues

Post by Novalak » Mon Dec 08, 2014 9:20 am

neither worked

This is literally my whole script - i was testing

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
ReadIniFile>c:\Upload\test.ini,{"Testing"},{"user"},strUserName
Let>name=strUserName

along with my ini

[Testing]
user=Novalak

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

Re: Reading ini files issues

Post by Marcus Tettmar » Mon Dec 08, 2014 10:49 am

Makes no sense. Unless the INI file is not where you think it is and the path is wrong. Or the INI file has some weird format. Can you attach your INI file and script file here. See "Upload attachment" tab below the post edit box.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Novalak
Newbie
Posts: 9
Joined: Sun Dec 07, 2014 10:23 am

Re: Reading ini files issues

Post by Novalak » Mon Dec 08, 2014 11:44 am

uploaded the ini file as well as the screenshot of the path

running 14.2.01

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

Re: Reading ini files issues

Post by Marcus Tettmar » Mon Dec 08, 2014 12:07 pm

Your INI file is fine. Works nicely for me. I did a screencast to show you which might jog something:
http://vids.mjtnet.com/watch/c2ljljeZ3Q
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Novalak
Newbie
Posts: 9
Joined: Sun Dec 07, 2014 10:23 am

Re: Reading ini files issues

Post by Novalak » Mon Dec 08, 2014 11:21 pm

i dont know why, but i recreated my scriptfile and my ini and started working

anyway next problem

ReadIniFile>%SCRIPT_DIR%\settings.ini,Buttons,march,strMarch
Let>march=strMarch
MouseMove>%march%

INI File
[Buttons]
; march button
march=1200,780


Error in: INI
Line: 6 - Missing parameters in function call (minimum of 2 expected)

Novalak
Newbie
Posts: 9
Joined: Sun Dec 07, 2014 10:23 am

Re: Reading ini files issues

Post by Novalak » Mon Dec 08, 2014 11:39 pm

I even tried to split the settings into x and y and still MoveMouse wont accept a variable

ChampTech
Newbie
Posts: 2
Joined: Fri Nov 28, 2014 6:51 pm

Re: Reading ini files issues

Post by ChampTech » Tue Dec 09, 2014 3:26 am

I believe the cause of the problem was that it was located c:\Upload\ which requires administrative rights, you can be the administrator and still have this problem... if you put the file in a location that doesn't require administrator permission it will read the file.
That's why putting it in script_dir worked out for you (Guessing the directory is in your document file)

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

Re: Reading ini files issues

Post by JRL » Tue Dec 09, 2014 4:53 am

Line: 6 - Missing parameters in function call (minimum of 2 expected)
MouseMove> requires two parameters

If your ini file has the x and y coordinates on separate lines try:

Code: Select all

ReadIniFile>%script_dir%\settings.ini,Buttons,marchx,strMarch1
ReadIniFile>%script_dir%\settings.ini,Buttons,marchy,strMarch2

MouseMove>strMarch1,strMarch2
You could also use the ini format where both coordinates are on one line. In that case your code would be something like this:

Code: Select all

ReadIniFile>%script_dir%\settings.ini,Buttons,march,strMarch
Separate>strMarch,comma,vPos

MouseMove>vPos_1,vPos_2

Novalak
Newbie
Posts: 9
Joined: Sun Dec 07, 2014 10:23 am

Re: Reading ini files issues

Post by Novalak » Wed Dec 10, 2014 3:32 am

thanks that works cheers

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