Jump to content
Sign in to follow this  
RoscoeT

Silly little iniread problem, Always returns default

Recommended Posts

RoscoeT

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

Share this post


Link to post
Share on other sites
Aceguy

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

Share this post


Link to post
Share on other sites
RoscoeT

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

Share this post


Link to post
Share on other sites
RoscoeT

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?

Share this post


Link to post
Share on other sites
RoscoeT

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.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×