WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Sending Keystrokes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Copying Excel Fields with Carriage Return/Line Feeds into Clipboard

Keywords: 	 cr CR carriage returns  line feed linefeed 

Question:

OK... I'm trying to write a script to copy data from a microsoft excel field and then put it into a field in another window ... the other window will look up the information I requested and a field will be selected from it and then pasted back into excel in the cell next to the orig. However I can't get it to stop... Here's what I've tried...
   sendkeysto("Microsoft Excel","^c")
   endcheck = clipget()
   if endcheck == @cr then goto end
   endif
   sendkeysto("PowerTerm","!ep")
The problem is a blank field in excel is copied as a carridge return I tried using @crlf, "@crlf",@lf,"@lf",@cl,"@cl","~",~,^m,"^m"... it still passes the if statement as "False"... Any ideas?

Answer:

The trick is to get rid of the carriage return annoyances first. When Excel pastes into the clipboard, ALL variables have a CRLF on the end.
   sendkeysto("Microsoft Excel","^c")
   endcheck = clipget()
   endcheck=StrReplace(endcheck,@CR,"")
   endcheck=StrReplace(endcheck,@LF,"")
   if endcheck == "" then goto end
   sendkeysto("PowerTerm","!ep")

Article ID:   W13822
Filename:   Copying Excel Fields with CRs into Clipboard.txt
File Created: 1999:04:15:16:56:36
Last Updated: 1999:04:15:16:56:36