gcue Posted June 2, 2008 Share Posted June 2, 2008 (edited) as part of a for loop, im trying to append lines to an INI section.ive tried using _FileWriteToLine($ini, 6, "PC=" & $aResult, 0)but that doesnt seem to write anythingso i tried usingIniWriteSection($ini, "LOCATION1_ASSETS", "PC=" & $aResult, 0)but that just keeps replacing the same line Edited June 2, 2008 by gcue Link to comment Share on other sites More sharing options...
nitekram Posted June 2, 2008 Share Posted June 2, 2008 Have you tried to open the file before trying to write to it? 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
GEOSoft Posted June 2, 2008 Share Posted June 2, 2008 as part of a for loop, im trying to append lines to an INI section.ive tried using _FileWriteToLine($ini, 6, "PC=" & $aResult, 0)but that doesnt seem to write anythingso i tried usingIniWriteSection($ini, "LOCATION1_ASSETS", "PC=" & $aResult, 0)but that just keeps replacing the same lineIn an INI file you can not use two keys with the same name in the same section so none of the INI functions will work for you. If you manually insert a line into a section which has the same key name as another, then only the first one will be found during an INI operation. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gcue Posted June 2, 2008 Author Share Posted June 2, 2008 still the same problemIf FileExists ("\\" & $aResult & "\c$") Then$user = RegRead("\\" & $aResult & "\HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Altiris Agent\Inventory", "PrimaryUser")IniWriteSection($ini, "LOCATION1_ASSETS", $user & "=" & $aResult, 0)EndIf Link to comment Share on other sites More sharing options...
GEOSoft Posted June 2, 2008 Share Posted June 2, 2008 (edited) still the same problemFirst of all, for a single entry you don't need IniWriteSection(), INIWrite() is enough. Secondly you don't put the = sign in the key name So instead of "PC=" you want "PC". Thirdly if the Key PC already exists then an IniWrite() of any type will only update that key with a new value and then you will only see it if the value has changed. As I said before, you can not have two key names of the same name in the same Ini section. Edited June 2, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gcue Posted June 2, 2008 Author Share Posted June 2, 2008 got it working!! thanks fellas. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now