stuka Posted November 6, 2008 Share Posted November 6, 2008 (edited) . Edited August 23, 2009 by stuka Link to comment Share on other sites More sharing options...
Pain Posted November 6, 2008 Share Posted November 6, 2008 Iniread doesn't return true or false (1 or 0). If it fails it return the default value, in your case "0". Link to comment Share on other sites More sharing options...
Bert Posted November 6, 2008 Share Posted November 6, 2008 You don't use FileOpenDialog to access the ini. Just give the path to the file. IniRead will open it and read the key. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Pain Posted November 6, 2008 Share Posted November 6, 2008 (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 November 6, 2008 by Pain Link to comment Share on other sites More sharing options...
zerobazar Posted November 6, 2008 Share Posted November 6, 2008 (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 November 6, 2008 by zerobazar Link to comment Share on other sites More sharing options...
Bert Posted November 6, 2008 Share Posted November 6, 2008 I was trying to use FileOpenDialog to tell IniRead which file to read... maybe wrong usage. But is there another better way to do this?$key = iniread(@scriptdir&"/setting.ini", "section", "key", "default")As I said in the first post. You don't use FileOpenDialog with iniread. Just use iniread to get your key. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted November 6, 2008 Share Posted November 6, 2008 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. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted November 6, 2008 Share Posted November 6, 2008 I put the first msgbox to simply check to see if you were getting a return from the FileOpenDialog. You can remark lines 2 and 3 out if you know that part is working for you. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now