AutoHotkey Community

It is currently May 27th, 2012, 8:02 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: save -editbox trouble
PostPosted: December 21st, 2004, 3:08 pm 
Offline

Joined: July 22nd, 2004, 6:33 am
Posts: 193
Location: cedar city UT
i'm trying to save text from a editbox i got it to save ok but it looks like this :
would there be a way to save without the boxes i'm useing a FileSelectFile
to save s8 so it creates a new file it don't seem to want to save without them litle boxes

Code:
Buttonsave:

FileSelectFile, SelectedFile, s8, ,Open a file, Text Documents (*.txt)
if SelectedFile =

   MsgBox, The user didn't select anything.

else

ControlGetText, OutputVar1,Edit1
FileAppend, %OutputVar1%, %SelectedFile%.ahk



Return




Code:
Buttonnew:[]


Reload[] 


return[]
[/code]

_________________
^sleepy^


Report this post
Top
 Profile  
Reply with quote  
 Post subject: oldbug
PostPosted: December 21st, 2004, 7:58 pm 
Offline

Joined: December 19th, 2004, 2:37 pm
Posts: 5
FileSelectFile, SelectedFile, 2, ,Open a file, Text Documents (*.txt)
if SelectedFile =
{
MsgBox, The user didn't select anything.
Return
}
else
ControlGetText, OutputVar1,Edit1
FileAppend, %OutputVar1%, %SelectedFile%.ahk
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject: oldbug
PostPosted: December 21st, 2004, 8:03 pm 
Offline

Joined: December 19th, 2004, 2:37 pm
Posts: 5
gmmm....My Error: "SelectedFile, 2"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 21st, 2004, 10:33 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Nice example. I made the change you indicated to your original post. In case you didn't know, you can edit your own posts with the Edit button.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 22nd, 2004, 12:25 am 
Offline

Joined: July 22nd, 2004, 6:33 am
Posts: 193
Location: cedar city UT
Yes thats like what i have in that that example but when i save the text in the editbox it saves ok but it saves it with litle boxes evrywhere
i know that the same thing was happing a while ago when i was doing the file open but the problom was fix'd when i use'd the `r`n


Contents = %Contents%%A_LoopReadLine%`r`n

_________________
^sleepy^


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 22nd, 2004, 2:29 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
sleepyy35 wrote:
but when i save the text in the editbox it saves ok but it saves it with litle boxes evrywhere
The is probably caused by the following statement recently added to ControlGetText: "Text retrieved from most control types uses carriage return and linefeed (`r`n) rather than a solitary linefeed (`n) to mark the end of each line."

If you download the latest version (released yesterday), I think it will fix this issue because FileAppend auto-detects `r`n (CRLF), and writes the file correctly.

To make it work on older versions, you could use StringReplace:
StringReplace, OutputVar1, OutputVar1, `r`n, `n, All


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: bobbysoon, BrandonHotkey, just me and 73 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group