Jump to content

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

  • Developers

test the returncode to see what happends:

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

[drivers]
wave=mmdrv.dll
timer=timer.drv

[mci]
[driver32]
[386enh]
woafont=dosapp.FON
EGA80WOA.FON=EGA80WOA.FON
EGA40WOA.FON=EGA40WOA.FON
CGA80WOA.FON=CGA80WOA.FON
CGA40WOA.FON=CGA40WOA.FON

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!
Link to comment
Share on other sites

  • Administrators

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
    else
  vResult = 0;       // Error, default is 1

} // IniWrite()

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

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