Jump to content

Getting text from Cliget()


Recommended Posts

Hi in my code, I try to select a desired text and then copy it by Sending ^c. (Code below). I want to be able to save this text and search it for substrings. However when I use Clipget() the variable is alway empty. Later in my program I paste the stuff I copied, into a different note, that works fine. Can I please get help with what I am doing wrong?

 

....  
        If pcheck(266, 200, 268, 788, 0x0070C1) Then
                    pcheck(298, $gy, 500, 66, 0x000000)
                    MouseMove(1400, $gy + 1)
                    shiftclick()
                    Sleep(1000)
                    Send("^c")
                    $APData = clipget()
                Else
                    MouseMove(500, 716)
                    shiftclick()
                    Sleep(1000)
                    Send("^c")
                    $APData = clipget()
                EndIf
                
                ....

I would like $APData to be the text that I just copied with ^C command prior. However $APdata ends up empty. Any help would be great. Thanks. 

Link to comment
Share on other sites

  • Moderators

@rimmi2002 this works fine for me

WinActivate("Untitled", "")
Sleep(500)
Send("^a")
Send("^c")
Sleep(500)
Send("{ENTER 4}")
Sleep(500)
Send(ClipGet())

However it is a little difficult to offer more in the way of suggestions when you show non-runnable code with a MouseClicks, etc. What app are you trying to automate, and why can you not use Control* commands instead of MouseClicks and Sends, which are woefully unstable?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks. I figured it out. I guess when doing this:

Send("^c")
 $APData = clipget()

The Clipget() is executed before the text is copied to clipboard, by previous command. Putting a 500ms Sleep in there makes it work just fine. Once I changed the code to below: this worked well.

Send("^c")
 Sleep(500)
 $APData = clipget()

 Thanks for the help. 

Link to comment
Share on other sites

2 hours ago, Danp2 said:

What application are you trying to interact? There's likely a better way to capture the text than using MouseMove, Send, etc.

I am interacting with medical software Epic Hyperspace, unfortunately all the "control" commands do not work. Autoit info tool is not able to read any control applets on this app. 

Link to comment
Share on other sites

  • Moderators

No, for Epic you would need to use IUIAutomation; there is a thread in our Examples forum. I have done some work with it in the past, but no longer have access to it to provide concrete examples.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13 Can you elaborate a little on using IUIAutomation with Epic? I am trying to do it right now but I'm finding it a little confusing. Especially because simplespy.au3 seems to just grab the entire Epic window instead of individual elements.

UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Link to comment
Share on other sites

  • 2 weeks later...

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...