Jump to content
Sign in to follow this  

Using Iniwrite On The System.ini

Recommended Posts


Ok I am fairly new to AutoIT but have been getting along so far. I am trying to make an entry in the system.ini file under the [mci] section. I can not get it to work at all. I get no error message, nothing. if I change the section to any of the oter sections or create a new section the ini file edit works correctly.

Here is the line, with $Files being the full path to the system.ini:

IniWrite($files, "mci", "poop", "true")

What gives? Anyone else run across this?

Edited by pingthis

Share this post

Link to post
Share on other sites

test the returncode to see what happends:

$rc=IniWrite($files, "mci", "poop", "true")
if $rc then
  ; Success: Returns 1. 
  ; Failure: Returns 0 if file is read-only. 

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

Share this post

Link to post
Share on other sites

I get a return code of 1

But still no entry in the system.ini


Share this post

Link to post
Share on other sites

Strange... Really strange.

Same behavior here on Windows XP Pro sp1. I can write to other sections but not mci.... My system.ini file looks like:

; for 16-bit app support



Edit: It does not even work on a copy of the file :D Bug in IniWrite?

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post

Link to post
Share on other sites

Not unless you can see a bug in the code, which is tiny:

void AutoIt_Script::IniWrite(VectorVariant &vParams, Variant &vResult)
    char    szFileTemp[_MAX_PATH+1];

    // Get the fullpathname (ini functions need a full path) 
    Util_GetFullPathName(vParams[0].szValue(), szFileTemp);

    if (WritePrivateProfileString(vParams[1].szValue(), vParams[2].szValue(), vParams[3].szValue(), szFileTemp))
  WritePrivateProfileString(NULL, NULL, NULL, szFileTemp);  // Flush
  vResult = 0;       // Error, default is 1

} // IniWrite()

Share this post

Link to post
Share on other sites

I get messed up results on this particular file all the way around. I can't even begin to explain it, but I can actually get it to set stuff that doesn't appear (IniWrite) then read that back in (IniRead), yet my text editor (Nor DOS edit) show any of what I'm reading/writing.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.