Sign in to follow this  
Followers 0
rudi

iniread(): When "default" is set to boolean False, it's True. Why?

4 posts in this topic

Hi.

#cs

------------ sample.ini------------
[tenovis]
value1=something
value2=something
;Alternative Gatekeeper=10.20.40.30,10.20.40.31
---------- EOF sample.ini ---------
#ce



Dim $ini = "c:\temp\sample.ini"
$tmp=False

if $tmp Then
    MsgBox(0,"True",$tmp)
Else
    MsgBox(0,"False",$tmp)
EndIf


$Tmp = IniRead($ini, "Tenovis", "Alternative Gatekeeper", False)
ConsoleWrite($tmp & @CRLF)
if $tmp Then
    MsgBox(0,"True",$tmp)
Else
    MsgBox(0,"False",$tmp)
EndIf

What do I miss? Autoit 3.3.0.0

(When removing the comment, the result is as expected: the IPs are displayed, and the compare is true)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Looks like IniRead returns a string of "False"...

#cs

------------ sample.ini------------
[tenovis]
value1=something
value2=something
;Alternative Gatekeeper=10.20.40.30,10.20.40.31
---------- EOF sample.ini ---------
#ce



Dim $ini = "c:\temp\sample.ini"
$tmp=False
If NOT IsString($tmp) Then MsgBox(0,"$tmp=False",$tmp & " is NOT a string")
$tmp = IniRead($ini, "Tenovis", "Alternative Gatekeeper", False)
If IsString($tmp) Then MsgBox(0,"$tmp=IniRead",$tmp & " is a string")
Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Return Value

Success: Returns the requested key value.

Failure: Returns the default string if requested key not found.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Looks like IniRead returns a string of "False"...

You are right. I checked this, but had a typo in my code :)

It's just WAD, as the help file states, that INIREAD() is returning the "default" value as a string.

Thanks, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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  
Followers 0