Jump to content

ControlSend() and ClipGet()


Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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,"")

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...