Sign in to follow this  
Followers 0
StataUser

ControlSend() and ClipGet()

3 posts in this topic

Hi,

I have the following line in my script:

ControlSend ( "Intercooled Stata 8.2", "Stata Command", "RICHEDIT1", ClipGet() & "{Enter}")

It works as expected, with the exception that, when multiple lines of text are copied to the clipboard, an extra line is added after each line of text. So, what was

foo

bar

comes out as

foo

bar

. Any idea why this, and how to get around?

Second question:

Is there some way to process some selected text (possibly multiple lines) from a text editor by means of AutoIt without copying to the clipboard? The idea is to keep whatever is in the clipboard but process the lines anyway. It would be also nice to be able to distinguish if some text has been selected or not.

Thanks a lot,

Eva

Share this post


Link to post
Share on other sites



You could try to use ControlGetText ( "title", "text", "classnameNN" ) when you know the controlname.

As far as the Extra line, The text contains probably extra CR's or LF's.

You could get rid of those by doing:

$string = StringReplace($string,@cr,"")

$string = StringReplace($string,@lf,"")


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks,

indeed, the extra line feeds were the problem. Thanks for the hint how to remove them.

For the other problem, it did not come to my mind simply to save whatever is the content of the clipboard to a $variable, and ClipPut($variable) it back again. That works nicely.

Best,

Eva

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0