lordicast Posted November 9, 2007 Posted November 9, 2007 (edited) [OLD] Why wont this work? my head hurts. IniWrite("C:\Temp\myfile.ini", "section2", "key", @username @MON @MDAY @MIN) [NEW] IniWrite("C:\log.ini", "Greating", "Hi","@Username&"Welcome in to the room") How do i make it so that each time this ini file is written to it appears on the next line without overwriting? Edited November 10, 2007 by lordicast [Cheeky]Comment[/Cheeky]
Developers Jos Posted November 9, 2007 Developers Posted November 9, 2007 Why wont this work? my head hurts.Is that the reason for posting in the wrong forum ?IniWrite("C:\Temp\myfile.ini", "section2", "key", @username @MON @MDAY @MIN)You need to use an & to concatenate the 4 macro values Moved topic 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.
lordicast Posted November 9, 2007 Author Posted November 9, 2007 No the reason was that i was searching other topics in Iniwrite and while on one that was in general Help i hit new topic BTW IniWrite("C:\Temp\myfile.ini", "section2", "key", @username& @MON& @MDAY& @MIN&) doesnt work either [Cheeky]Comment[/Cheeky]
Developers Jos Posted November 9, 2007 Developers Posted November 9, 2007 (edited) Skip the last & Edited November 9, 2007 by Jos 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.
lordicast Posted November 9, 2007 Author Posted November 9, 2007 Now the hard part is adding text in between like IniWrite("C:\Temp\myfile.ini", "section2", "key", @username& "logged in on" @MON& "/"@MDAY& /@YEAR& "at" @HOUR& ":" @MIN) [Cheeky]Comment[/Cheeky]
Moderators SmOke_N Posted November 9, 2007 Moderators Posted November 9, 2007 Guess you're missing the obvious. You were told to add an ampersand between the strings/macro's you were trying to concatenate the strings together. So any string, you want to merge: $sString1 = "I " & "am " & "a " & "string." $sString2 = "Your username: " & @UserName & " , is this correct?" MsgBox(64, "info", $sString1 & @CRLF & $sString2) 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.
lordicast Posted November 9, 2007 Author Posted November 9, 2007 Nice i didnt understand the value of & it used to string breaks together in a given line thanks. [Cheeky]Comment[/Cheeky]
lordicast Posted November 10, 2007 Author Posted November 10, 2007 See first post please [Cheeky]Comment[/Cheeky]
JSunn Posted November 10, 2007 Posted November 10, 2007 See first post pleaseDid you get this figured out?-John
lordicast Posted November 10, 2007 Author Posted November 10, 2007 no. i havent figured out IniWrite("C:\log.ini", "Greating", "Hi","@Username&"Welcome in to the room") How do i make it so that each time this ini file is written to it appears on the next line without overwriting? [Cheeky]Comment[/Cheeky]
BrettF Posted November 10, 2007 Posted November 10, 2007 no. i havent figured out IniWrite("C:\log.ini", "Greating", "Hi","@Username&"Welcome in to the room") How do i make it so that each time this ini file is written to it appears on the next line without overwriting?You can't write your ini with the same values in the key in one section... You can count the values ($val = IniReadSection ( "filename", "section" ), the total will be $val[0][0]) then write the key with a number +1 ($total += $val[0][0]). Your " at the start of the value, should not be there, unless you have Opt ("ExpandVarStrings", 1) and the " in the middle removed. We won't go into that. In the end, your code where you write the key should look something like: IniWrite("C:\log.ini", "Greating", "Hi" & $total, @Username & "Welcome in to the room") Just use what I suggested, and see how you go Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
lordicast Posted November 10, 2007 Author Posted November 10, 2007 thanks burt very helpful [Cheeky]Comment[/Cheeky]
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