Jump to content

trying to append lines to an INI section


Recommended Posts

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 anything

so i tried using

IniWriteSection($ini, "LOCATION1_ASSETS", "PC=" & $aResult, 0)

but that just keeps replacing the same line

Edited by gcue
Link to comment
Share on other sites

Have you tried to open the file before trying to write to it?

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

 

WindowsError.gif

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

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 anything

so i tried using

IniWriteSection($ini, "LOCATION1_ASSETS", "PC=" & $aResult, 0)

but that just keeps replacing the same line

In 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

still the same problem

If 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

still the same problem

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

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