Sunaj Posted October 8, 2007 Share Posted October 8, 2007 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 [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Bert Posted October 8, 2007 Share Posted October 8, 2007 (edited) Have you tried to test it on a different app line notepad to see if your code works?didn't read the code first...let me test Edited October 8, 2007 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted October 8, 2007 Share Posted October 8, 2007 (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 October 8, 2007 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
weaponx Posted October 8, 2007 Share Posted October 8, 2007 Could it even have to do with the manner in which you use Send()? I see you both sent Ctrl + C differently. Link to comment Share on other sites More sharing options...
Bert Posted October 8, 2007 Share Posted October 8, 2007 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. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Sunaj Posted October 8, 2007 Author Share Posted October 8, 2007 @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. [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Sunaj Posted October 9, 2007 Author Share Posted October 9, 2007 bump [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now