 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
tekkie2412
Joined: 22 May 2007 Posts: 73
|
Posted: Thu Oct 22, 2009 10:41 pm Post subject: Junk captured by clipboard or ControlSendText |
|
|
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 |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 1158 Location: San Diego, California
|
Posted: Thu Oct 22, 2009 10:59 pm Post subject: |
|
|
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/viewtopic.php?t=22923&highlight=excel+com |
|
| Back to top |
|
 |
tekkie2412
Joined: 22 May 2007 Posts: 73
|
Posted: Thu Oct 22, 2009 11:12 pm Post subject: |
|
|
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
|
|
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 1158 Location: San Diego, California
|
Posted: Fri Oct 23, 2009 1:41 am Post subject: |
|
|
| Quote: | | The stringreplace works semi-perfectly |
Ok, how do we get a higher score than "semi" ?  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|