Jump to content
Sign in to follow this  
lordicast

IniWrite Problem(Solved)

Recommended Posts

lordicast

[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 by lordicast

[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites
Jos

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


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
lordicast

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]

Share this post


Link to post
Share on other sites
lordicast

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]

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
lordicast

Nice i didnt understand the value of & it used to string breaks together in a given line thanks.


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites
lordicast

See first post please


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites
JSunn

See first post please

Did you get this figured out?

-John

Share this post


Link to post
Share on other sites
lordicast

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]

Share this post


Link to post
Share on other sites
BrettF

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

Share this post


Link to post
Share on other sites
lordicast

thanks burt very helpful


[Cheeky]Comment[/Cheeky]

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  

×