Jump to content

writing to ini file


tamir
 Share

Recommended Posts

i have a script that writes into ini file and (which doesn't exists yet).

sometimes, especially when i use the compiled .exe file, it doesn't creates the ini file. moreover, i made the script checking if the ini file exists and if it is missing give an error message, but even when it fails, there is no error message.

why is it happening? is it better to create the file and only then use IniWrite?

Link to comment
Share on other sites

An example of how to use the INI functions.

Dim $IniFile
$IniFile = StringTrimRight(@ScriptFullPath, 3) & "ini"
$value = INIRead($IniFile, "Settings", "WordWrap", "No INIFile");<-- if the INI file doesn't exist, $value will equal the last parameter.
If $value = "No INIFile" Then
   INIWrite($IniFile, "Settings", "WordWrap", "Off")
Else
  ;INIFile exists, do whatever you want.
EndIf
Link to comment
Share on other sites

i have a script that writes into ini file and (which doesn't exists yet).

sometimes, especially when i use the compiled .exe file, it doesn't creates the ini file. moreover, i made the script checking if the ini file exists and if it is missing give an error message, but even when it fails, there is no error message.

why is it happening? is it better to create the file and only then use IniWrite?

<{POST_SNAPBACK}>

Hello Tamir,

Could you give a code snippet with your IniWrite lines?

I could think of a filepath problem. If you want the INI file to be created in the same directory as your compiled script, you could add the @SCRIPTDIR macro in front of the filename.

Regards,

-Sven

Link to comment
Share on other sites

well, in the end it was a path problem, coz i tried

@ScriptDir & "\file.ini" instead of "file.ini" and it worked.

i'm just not usual that if i write "file.ini" it isn't in the same dir as the script, coz in php it is...

thanks for all.

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