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 

Need help with 'new line' in 'FileAppend ,'

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



Joined: 28 Nov 2008
Posts: 111
Location: United Kingdom

PostPosted: Thu Dec 18, 2008 7:08 pm    Post subject: Need help with 'new line' in 'FileAppend ,' Reply with quote

Ok here is my problem,
Code:

ButtonADD:
Gui,Submit,Nohide
FileAppend ,
(
                                            ;<<<<<<< here
::%AbAddName%::%FullAddName%
), AbbreviationData.ahk
MsgBox, The abbreviation entered has been added to the library.
Reload
Return

I need that return( enter pressed ) to make sure that each is saved on a new line, although this leaves a lin blank at the top of the text file, how can I eliminate this empty line ?

Edit: I did post this earlier although it seems to have disappeared from existance
_________________
Adam
http://moourl.com/8w0tx
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Thu Dec 18, 2008 7:30 pm    Post subject: Reply with quote

What you had asked for:

Code:
ButtonADD:
Gui,Submit,Nohide
FileAppend, % (FileExist("AbbreviationData.ahk") ? "`n" : "" )
            . "::" AbAddName "::" FullAddName, AbbreviationData.ahk
MsgBox, The abbreviation entered has been added to the library.
Reload
Return


But this is simpler:

Code:
ButtonADD:
Gui,Submit,Nohide
FileAppend, % "::" AbAddName "::" FullAddName "`n", AbbreviationData.ahk
MsgBox, The abbreviation entered has been added to the library.
Reload
Return

_________________
URLGet - Internet Explorer based Downloader
Back to top
View user's profile Send private message Send e-mail
menaphus



Joined: 28 Nov 2008
Posts: 111
Location: United Kingdom

PostPosted: Thu Dec 18, 2008 10:03 pm    Post subject: Reply with quote

ok sorry for being stupid but what are the "%" and the "`n" doing i just want to understand what im doing so i can use it Smile
_________________
Adam
http://moourl.com/8w0tx
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Fri Dec 19, 2008 2:43 am    Post subject: Reply with quote

`n is newline ( or linefeed ) Character that helps by folding long sentences

The following two produce identical results
Code:
MsgBox, % "UserName: " A_UserName "`nComputer: " A_ComputerName
MsgBox, UserName: %A_UserName%`nComputer: %A_ComputerName%
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
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