Jump to content

MissingFile?


Recommended Posts

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

Link to comment
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.


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

Link to comment
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()

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

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