lopolop Posted August 16, 2006 Posted August 16, 2006 i am writing things to an ini an for some reason, my script works with IniWrite("Settings.ini" Etc...) and IniRead("Settings.ini" Etc...) But when i open the INI file.. there is no Key Value for The iniWrite and IniRead so how is it working? There is only a Autoit .exe and Settings.ini File there...
BigDod Posted August 16, 2006 Posted August 16, 2006 I think we need a bit more of your script to see what is going on especially the iniwrite and iniread parts. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
BPBNA Posted August 16, 2006 Posted August 16, 2006 You are declaring the section name, key name, and value in the IniWrite right?
lopolop Posted August 16, 2006 Author Posted August 16, 2006 ok well this is really weird... it seems to be writing to a folder where the Data is.. ok here is some script.. ;This is part of a GUI --- If $msg = $DirGUI Then $message = "Select Directory." $FileDialog = FileOpenDialog($message, "C:\", "Executable (*.exe)", 1 + 4) If @error Then MsgBox(4096, "", "No File(s) chosen") Else $Dir = StringReplace($FileDialog, "|", @CRLF) MsgBox( 0, "", $FileDialog & $Dir) IniWrite("Settings.ini", "Settings", "Dir", $Dir) EndIf EndIf Its weird because some how it created my Whole Settings.ini in the Folder of the File you selected then did IniWrite()
Helge Posted August 16, 2006 Posted August 16, 2006 (edited) Exactly as I thought. You're using FileOpenDialog which changes @WorkingDir, so if you go to the same folder for the file which you selected in FileOpenDialog, you will find your INI-file there To solve this you can either use FileChangeDir after FileOpenDialog, or you can specify the full path in your INI-functions. Damn spelling.. Edited August 16, 2006 by Helge
BPBNA Posted August 16, 2006 Posted August 16, 2006 I've never gotten this problem since whenever I do something like that, where I want a file saved in the same folder as my script, I use: IniWrite(@ScriptDir & "\Settings.ini", "Settings", "Dir", $Dir) Dont forget the \ since @ScriptDir doesnt add the trailing \ for you. It is much more reliable in any script to use exact paths or macros to write/read to/from a file or run an exe.
lopolop Posted August 16, 2006 Author Posted August 16, 2006 Thanks alot Helge and BPBNA got it working!
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