Sign in to follow this  
Followers 0
Sunaj

Problem With ClipGet() In OpenOffice

7 posts in this topic

When having text selected in OpenOffice and using a {ctrldown}c{ctrlup} alongside with a ClipGet() to fetch the data into a AutoIt script ... well basically this does not work for me, at all. I've tried various methods but wanted to go conservative and post it here before filing a bug report on it - can anyone get text from OpenOffice via clipboard in au3 and if so how?!

Below is a small script to easily replicate the behavior

Opt("GUIOnEventMode", 1)
; Problem with ClipGet() in OpenOffice
; please open an instance of "OpenOffice.org Writer" and write a few
; words then select them and press 'q' to replicate the problem 
; (text NOT getting copied or taking extremely long time, works fine with any other app I've tested(ie. notepad, word..etc))
HotKeySet("q","copy")
While 1
    Sleep(33)
WEnd
Func copy()
    Send("{ctrldown}c{ctrlup}")
    $i = ClipGet()
    $j = TimerInit()
    MsgBox(48,"Trialing Clipboard","It took: " & $j & " milliseconds to copy " & '"' & $i & '"' & " from clipboard?!")
    Exit
EndFunc

Cheers for all input on this one :)

Sunaj

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I have found that some apps are resistant to keystrokes being sent to copy things to the clipboard. My only solution is to repeat the command several times to insure it works

Opt("GUIOnEventMode", 1)
; Problem with ClipGet() in OpenOffice
; please open an instance of "OpenOffice.org Writer" and write a few
; words then select them and press 'q' to replicate the problem 
; (text NOT getting copied or taking extremely long time, works fine with any other app I've tested(ie. notepad, word..etc))
HotKeySet("q","copy")
While 1
    Sleep(33)
WEnd
Func copy()
                clipput("") ; clears clipboard first 
    Send("^c")
    Send("^c")
    Send("^c")
    $i = ClipGet()
    $j = TimerInit()
    MsgBox(48,"Trialing Clipboard","It took: " & $j & " milliseconds to copy " & '"' & $i & '"' & " from clipboard?!")
    Exit
EndFunc
Edited by Volly

Share this post


Link to post
Share on other sites

Could it even have to do with the manner in which you use Send()? I see you both sent Ctrl + C differently.

Share this post


Link to post
Share on other sites

@Volly, hey dude, thanks for your input here (reply comes a bit late, I've been involved in a traffic accident and whatnot.. life away from the screen can be seriously dangerous!).

I tried using the various proposed methods to no avail (including altering the SendKeyDownDelay & SendKeyDelay). The only way to get -any- text with the copy method off openoffice is the classic:

Send("{ctrldown}c{ctrlup}")

$i = ClipGet()

With somewhat normal timings on the aforementioned parameters.. however; works (sometimes) after pressing 'q' a two times in succession (see test code above if new to subject) but has now caused OpenOffice to crash on me twice!! Plus - ControlSend is not an option since openoffice uses custom strange controls that can't be seen with AU3Info. This is one hard nut to crack!

The way I did it is simple way to go, but you may want to try ControlSend. Did you test it and did it work? Also, try to see is doing the keystroke works manually. If so, you could slow down the keystroke to see if that fixes it.

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