AutoHotkey Community

It is currently May 26th, 2012, 10:13 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: October 22nd, 2009, 11:41 pm 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
Im copying data from a spreadsheet via ^c (OpenOffice currently), about 10 values, then sending the value using ControlSendText to another application. The values all go to the correct controls on the application, but there is always trailing garbage. For example, if I have it copy "123 Sesame Street" from the spreadsheet, ControlSetText sends "123 Sesame Street□□". If I paste into the browser or notepad it looks correct, so I dont think its happening in the clipboard. Any suggestions?

Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 22nd, 2009, 11:59 pm 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6065
Location: San Diego, California
I suggest that the junk is CR/LF http://www.autohotkey.com/docs/misc/Clipboard.htm
Quote:
Each line of text on Clipboard typically ends with carriage return and linefeed (CR+LF), which can be expressed in the script as `r`n.

Ths script will illustrate and possibly give you an idea how to proceed.
Select a cell in the spreadsheet and then hit Win-q

Code:
#q:: ; win-q hotkey
Send ^c
clipwait, 1,1

msgbox before '%clipboard%'

StringReplace, clipboard, clipboard,`r`n,,all

msgbox after '%clipboard%'


An alternative is to use COM, which I have not explored
http://www.autohotkey.com/forum/viewtop ... =excel+com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 23rd, 2009, 12:12 am 
Offline

Joined: May 22nd, 2007, 1:06 am
Posts: 73
Ah yes, I forgot about string replace. I was trying all these and going nuts. The stringreplace works semi-perfectly :)

Code:
ControlSetText, control, %Name%`r`n, WinName
ControlSend, control, %Name%, WinName
ControlSendRaw, control, %Name%, WinName


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 23rd, 2009, 2:41 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6065
Location: San Diego, California
Quote:
The stringreplace works semi-perfectly

Ok, how do we get a higher score than "semi" ? :wink:


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], hyper_, JSLover, Leef_me, oldbrother, patgenn123 and 64 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