Jump to content

Problem With ClipGet() In OpenOffice


Sunaj
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

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