AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

`n not working properly when outputting to ini

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Firewolf91



Joined: 19 Oct 2007
Posts: 127
Location: PA

PostPosted: Tue Nov 13, 2007 4:22 pm    Post subject: `n not working properly when outputting to ini Reply with quote

i don't know why i can't figure out this problem...maybe it's because i don't fully understand how line breaks work behind the scenes...but here's what's happening:

Code:
FileAppend, %exampleVar1%`n%exampleVar2%`n%exampleVar3%, logs\statistics.ini
sleep 100
FileAppend, `nRecorded Date-%currentMonth%/%currentDay%/%currentYear%;  Error Message-`"%text%`", logs\statistics.ini
FileRead, timelog, logs\timelog.ini
sleep 100
FileAppend, `n`n%timelog%`n, logs\statistics.ini


So what the output is SUPPOSED to look like is:
Code:
exampleVar1
exampleVar2
exampleVar3
Recorded Date-11/13/2007;  Error Message-"ROM Drive is Empty.

abort"

Date: Tuesday, November 13, 2007 @ 09:59:41 AM, Time Elapsed: 0:00:04, Error Message: ROM Drive Is Empty.  abort    ; this is what is found in the "timelog" file


so far, most of the line breaks are fine. but my problem is that it ALWAYS outputs like this:
Code:
exampleVar1
exampleVar2
exampleVar3
Recorded Date-11/13/2007;  Error Message-"ROM Drive Is Empty.

abort"Date: Tuesday, November 13, 2007 @ 09:59:41 AM, Time Elapsed: 0:00:04, Error Message: ROM Drive Is Empty.  abort


if u set the cursor before the " between abort and Date and then press the right arrow key, it takes 5 presses before it stops between the "D" and "a", when it should only take 2...so obviously something is there, but i don't know why it's not working as it should and going to the next line.
should i use something else other than `n? i tried `r but that had the same results.

thanks in advance for any light on the subject.
Back to top
View user's profile Send private message
Firewolf91



Joined: 19 Oct 2007
Posts: 127
Location: PA

PostPosted: Tue Nov 13, 2007 4:25 pm    Post subject: Reply with quote

oh yeah, i forgot to ask...does it have something to do with reading in data from a file (that IS the text i'm having trouble with)
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Tue Nov 13, 2007 6:23 pm    Post subject: Reply with quote

your code looks right to me Confused
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Xander



Joined: 23 Sep 2007
Posts: 142

PostPosted: Tue Nov 13, 2007 6:40 pm    Post subject: Reply with quote

You can try to insert
Code:
timelog = %timelog%

before writing it to the other file. I believe that trims off any whitespace.
Back to top
View user's profile Send private message
Firewolf91



Joined: 19 Oct 2007
Posts: 127
Location: PA

PostPosted: Tue Nov 13, 2007 6:53 pm    Post subject: Reply with quote

thanks for the suggestions xander. didn't have any effect in notepad tho.

but it got me thinking, i should use something to trim whitespace...then i wondered what would happen in MS word and wordpad...
both of those had different formatting of that section where i'm having the problem.
Word showed it properly, but had an extra space: (the Date line did have 2 breaks before it!)
Code:
"ROM Drive is Empty.

abort "

in wordpad, it showed up horrid:
Code:
"ROM Drive is Empty.

abort

"

and notepad showed the same results as before (no line break between abort" and Date. i'm almost positive it's some kind of code. it's not a space, it doesn't appear to be `n or `r...tho i could easily be wrong.
i have a loop that removes `n, or more if necessary, at the end of the %text%, but apparently i didnt get them all, there's 1 invisible character left.

i ... dunno. i'll keep working at it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group