Jump to content
Sign in to follow this  
BananaFredSoft

.ini writing error

Recommended Posts

BananaFredSoft

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
BananaFredSoft

athiwatc: There is no error message.

SmOke_N: Script posted.

Edit: Attachment removed.

Edited by BananaFredSoft

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
BananaFredSoft

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.

Share this post


Link to post
Share on other sites
Generator

One thing i noticed is ini won't write if the string is too long, maybe i did it wrong but it happened to me too.

Share this post


Link to post
Share on other sites
Jos

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

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

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  

×