Sign in to follow this  
Followers 0
lopolop

MissingFile?

7 posts in this topic

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...


Share this post


Link to post
Share on other sites



I think we need a bit more of your script to see what is going on especially the iniwrite and iniread parts.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

You are declaring the section name, key name, and value in the IniWrite right?

Share this post


Link to post
Share on other sites

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()


Share this post


Link to post
Share on other sites

#5 ·  Posted (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 :P

To solve this you can either use FileChangeDir after FileOpenDialog, or you can specify the

full path in your INI-functions.

Damn spelling..

Edited by Helge

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thanks alot Helge and BPBNA got it working!


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