Jump to content

ClipGet() Problem


_Kurt
 Share

Recommended Posts

Hey guys,

I don't know why this isn't working, it's probably something very obvious that I am missing. What I want to do: Copy the highlighted text to the clipboard (mainly want to grab the highlighted text, this is just the only way I've found to do so).

Send("^c")
$clipget = ClipGet()
If $clipget = "" Then
    MsgBox(0,"","No Highlighted text found")
Else
    MsgBox(0,"","This is the text in the clipboard" & @CRLF & $clipget)
EndIf

This doesn't copy it to the clipboard for some reason. Ugh, I'm sure this will end up being embarrassing since I'm tired and I know I'm missing something really obvious.

Thanks,

Kurt

Edited by _Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

In your second message box (when it finds text) shouldn't the last variable be $clipget?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Sorry for the late reply.

@mikehunt - Yes, I meant to put $clipget *edited first post*

@Uten - I believe that CTRL + C is the proper hotkeys to copy the highlighted or selected text to the clipboard.

I think that I have the proper functions and everything. I believe it may be the computer instead. I've noticed it works sometimes.

Edited by _Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

@Uten - I believe that CTRL + C is the proper hotkeys to copy the highlighted or selected text to the clipboard.

I think, he only wanted to say, that if the text isn't selected, you could mark all by sending ctrl+a.

What happens, if you use ctrl + c and ctrl + v in a text file or sth like that, just after your program tried to clipget? Does it work then? Or isn't it a autoit problem?

"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

Link to comment
Share on other sites

As I said is the text selected?

And witch window has focus when you use send?

I think your problem is that the window with the selected text does not he the focus when you run your script pice.

Link to comment
Share on other sites

I will attempt to try Volly's solution once I get home to my computer. It is strange though, maybe it needs time to record the selected text to the clipboard or something? Also, Uten, that is not the case, the window does infact have focus when I try to copy it. I wonder if there is any other way to record highlighted/selected text. Any ideas since the copy/clipget isn`t working?

Thanks,

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

its because sometimes it takes a while for the data to goto to the clipboard (ie: emptying and refilling) so the answer is put in a delay until clipboard has something such as..........

While StringLen(ClipGet()) = 0

Sleep(50)

Wend

then it always works.

hope that helped

Edited by Rick

Who needs puzzles when we have AutoIt!!

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