Jump to content

.ini writing error


Recommended Posts

For some reason when I use the following script, it makes a section for each key in a .ini. Any ideas?

IniWrite(@ScriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Year", GUICtrlRead($inpYear))
IniWrite(@ScmriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Genre", GUICtrlRead($inpGenre))
IniWrite(@ScriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Album Title", GUICtrlRead($inpAlbumTitle))
IniWrite(@ScriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Song Name", GUICtrlRead($inpSongName))
IniWrite(@ScriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Group Name", GUICtrlRead($inpGroupName))
IniWrite(@ScriptDir & "\Songs" & $num & ".data", "Other", "Number", IniRead(@ScriptDir & "\Songs" & $num & ".data", "Other", "Number", 0) + 1)
Edited by BananaFredSoft
Link to comment
Share on other sites

  • Moderators

For some reason when I use the following script, it makes a section for each key in a .ini. Any ideas?

IniWrite(@ScriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Year", GUICtrlRead($inpYear))
IniWrite(@ScmriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Genre", GUICtrlRead($inpGenre))
IniWrite(@ScriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Album Title", GUICtrlRead($inpAlbumTitle))
IniWrite(@ScriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Song Name", GUICtrlRead($inpSongName))
IniWrite(@ScriptDir & "\Songs" & $num & ".data", $fullpaths[$inum], "Group Name", GUICtrlRead($inpGroupName))
IniWrite(@ScriptDir & "\Songs" & $num & ".data", "Other", "Number", IniRead(@ScriptDir & "\Songs" & $num & ".data", "Other", "Number", 0) + 1)
Do you have a working example (we have no idea what the sections are even supposed to be!)?

Also your last IniWrite there... you have it adding a string to an integer :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

athiwatc: There is no error message.

SmOke_N: Script posted.

Edit: Attachment removed.

Edited by BananaFredSoft
Link to comment
Share on other sites

  • Moderators

athiwatc: There is no error message.

SmOke_N: Script posted.

I didn't mean post a 1200+ line script for us to debug... just write a small reenactment script that does what you are saying this script does... If you can't, then I would probably re-check my $fullpaths[$inum] with a message box before I started my IniWrite's... you'd probably find that they aren't the values you think they are...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I didn't mean post a 1200+ line script for us to debug... just write a small reenactment script that does what you are saying this script does... If you can't, then I would probably re-check my $fullpaths[$inum] with a message box before I started my IniWrite's... you'd probably find that they aren't the values you think they are...

Sorry. Actually, for some reason, it only does this with a certain folder (the section names are file paths). I think this is because the path is quite long. Here is a demo:

Long path:

$num = "test"
    IniWrite(@ScriptDir & "\Songs" & $num & ".data", "C:\Documents and Settings\Colin\My Documents\My Music\Good Charlotte\The Chronicles of Life and Death [Death Version]1 Once Upon a Time- The Battle of Life and Death.mp3", "Year", "2007")
    IniWrite(@ScriptDir & "\Songs" & $num & ".data", "C:\Documents and Settings\Colin\My Documents\My Music\Good Charlotte\The Chronicles of Life and Death [Death Version]1 Once Upon a Time- The Battle of Life and Death.mp3", "Genre", "music")
    IniWrite(@ScriptDir & "\Songs" & $num & ".data", "C:\Documents and Settings\Colin\My Documents\My Music\Good Charlotte\The Chronicles of Life and Death [Death Version]1 Once Upon a Time- The Battle of Life and Death.mp3", "Album Title", "test title")
    IniWrite(@ScriptDir & "\Songs" & $num & ".data", "C:\Documents and Settings\Colin\My Documents\My Music\Good Charlotte\The Chronicles of Life and Death [Death Version]1 Once Upon a Time- The Battle of Life and Death.mp3", "Song Name", "test song")
    IniWrite(@ScriptDir & "\Songs" & $num & ".data", "C:\Documents and Settings\Colin\My Documents\My Music\Good Charlotte\The Chronicles of Life and Death [Death Version]1 Once Upon a Time- The Battle of Life and Death.mp3", "Group Name", "test group")oÝ÷ Ù(h®ÚZ¶®¶­s`b33c¶çVÒÒgV÷C·FW7BgV÷C° æw&FR67&DF"fײgV÷C²b3#µ6öæw2gV÷C²fײb33c¶çVÒfײgV÷C²æFFgV÷C²ÂgV÷C·FW7BgV÷C²ÂgV÷CµV"gV÷C²ÂgV÷C³#rgV÷C² æw&FR67&DF"fײgV÷C²b3#µ6öæw2gV÷C²fײb33c¶çVÒfײgV÷C²æFFgV÷C²ÂgV÷C·FW7BgV÷C²ÂgV÷C´vVç&RgV÷C²ÂgV÷C¶×W62gV÷C² æw&FR67&DF"fײgV÷C²b3#µ6öæw2gV÷C²fײb33c¶çVÒfײgV÷C²æFFgV÷C²ÂgV÷C·FW7BgV÷C²ÂgV÷C´Æ'VÒFFÆRgV÷C²ÂgV÷C·FW7BFFÆRgV÷C² æw&FR67&DF"fײgV÷C²b3#µ6öæw2gV÷C²fײb33c¶çVÒfײgV÷C²æFFgV÷C²ÂgV÷C·FW7BgV÷C²ÂgV÷Cµ6öæræÖRgV÷C²ÂgV÷C·FW7B6öærgV÷C² æw&FR67&DF"fײgV÷C²b3#µ6öæw2gV÷C²fײb33c¶çVÒfײgV÷C²æFFgV÷C²ÂgV÷C·FW7BgV÷C²ÂgV÷C´w&÷WæÖRgV÷C²ÂgV÷C·FW7Bw&÷WgV÷C²

For me the error only occurs with the long path.

Link to comment
Share on other sites

  • Developers

MMM... You should not use Square brackets in the Section name I think ...

:)

This also fails:

$num = "test"
$secname = "C:\Do[cu]m"
IniWrite(@ScriptDir & "\Songs" & $num & ".data", $secname, "Year", "2007")
IniWrite(@ScriptDir & "\Songs" & $num & ".data", $secname, "Genre", "music")
Edited by JdeB

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

MMM... You should not use Square brackets in the Section name I think ...

So that's the problem. Thanks!

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