Jump to content

Recommended Posts

Posted

Hello All,

Every time I call iniread() I get the default value.

My ini file c:\list.ini :

[Section1]
Key="I love Autoit"

$link = IniRead("c:\list.ini","Section1","Key",False)
Msgbox(0,"Debug","Result is: " & @CRLF & $link)

The msgbox always says "Result it false";

Can anyone please tell me what I am doing wrong here?

Thanks a bunch

Posted (edited)

i would do

$inifile="C:\list.ini"
if fileextists($inifle)=1 then
$link = IniRead($inifile,"Section1","Key",False)
Msgbox(0,"Debug","Result is: " & @CRLF & $link)
else
Msgbox(0,"Test","Error you file was not read",0)
endif
Edited by Aceguy
Posted

I just tested it. Works for me. Are you sure the ini file is in the right place? Or you have it named wrong?

Thanks for the reply,

Very strange. I have double checked and even tried moving the file around.

I have re-written the INI section names and key names just to see if I could make a difference... nothing.

Any other suggestions?

Thanks.

R

Posted

Thanks for the help but strange results.

This code failed to read the file:

$inifile="C:\list.ini"
if FileExists($inifile)=1 then
$link = IniRead($inifile,"Section1","Key",False)
Msgbox(0,"Debug","Result is: " & @CRLF & $link)
else
Msgbox(0,"Test","Error you file was not read",0)
endifoÝ÷ Øz0z÷«¶¬r^ÂäyÖ¬{^r×jëh×6$path = "c:\list.ini"
IniWrite($path, "Section1","Key2", "This is some test data")
$link = IniRead($path,"Section1","Key2",False)
Msgbox(0,"Debug","Result is: " & @CRLF & $link)

What would cause that?

Posted

Ah crap!!!

I figured it out...

Thanks for all your help.

The stupid folder had "Hide extensions for known file types" set and the file's real name was list.ini.txt

God I hate that "Feature". :)

Sorry for the dumb ass noob stuff.

Thanks again guys.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...