Jump to content

Recommended Posts

Posted (edited)

yes but that returns the string "0", only 0 is a number that is same as false. Try If $inivar = "0" to use the returned string.

Edited by Pain
Posted (edited)

Then you should test like this:

...
If $inivar = "0" Then
...

You see the quotes?

No problem to use FileOpenDialog to pick the file you want to try/read.

Best Regards.

Oops. Pain has been too fast!

Edited by zerobazar
Posted

But I'm using FileOpenDialog to select which inf file I would like IniRead to read...

So that a user can browse for any inf files and choose it...i'm not using it for an .ini settings file...

I'm sorry, I misunderstood. OK, I tried the following to see if this would work, and it worked fine for me. I put in a msgbox to see if FileOpenDialog would show the path to the inf file first.

$openvar = FileOpenDialog("test", @HomeDrive, "Inf File (*.inf)", 1)
$inivar1 = IniRead($openvar, "autorun", "open", "0")
MsgBox(0, $inivar1, $openvar);returned path and the key. I made a inf file and it found it.
If @error Then
    Exit
Else
$inivar = IniRead($openvar, "autorun", "open", "0")
If $inivar = 0 Then
    MsgBox(4096,"","No such key")
Else
    MsgBox(4096,"","Key found!") 
EndIf
EndIf

Now, I coded my inf file like this:

[Autorun]

open=software.exe

Is your coded like this? you may want to check that.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...