pablo14170 Posted June 14, 2016 Share Posted June 14, 2016 I like to do autoit detects select text with the mouse or keyboard? I want to make a program that when you highlight a text then appears automatically a window that has buttons to copy and paste to the clipboard or translated into google. Link to comment Share on other sites More sharing options...
Synapsee Posted June 14, 2016 Share Posted June 14, 2016 (edited) look arround : https://www.autoitscript.com/autoit3/docs/functions/ClipGet.htm Edited June 14, 2016 by Synapsee Link to comment Share on other sites More sharing options...
pablo14170 Posted June 14, 2016 Author Share Posted June 14, 2016 It must be before copy. It must be when text is selected Link to comment Share on other sites More sharing options...
argumentum Posted June 14, 2016 Share Posted June 14, 2016 ..maybe something that gets mouseDown's X:Y and , of mouseUp X:Y , if one is too far from the prior, send a Ctrl+C, ..that way you can do it. Nope, I'm not gonna write it But that is the idea And welcome to the forums , hope you learn this language, is quite rewarding. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
t0nZ Posted June 14, 2016 Share Posted June 14, 2016 (edited) I do not remember who to thank sincerely for this, but I use it in various scripts, it works like a charm: expandcollapse popupFunc _GetTextFromActiveWindow() ;Get window title, in case we need it $window_title = WinGetTitle("[active]") If $window_title == "" Then Beep(600, 1000) Exit EndIf WinActivate($window_title) ClipPut("") ;Clear the clipboard, so we can check for data when we write to it $readtext = "" ;We'll put new clipboard data in this variable For $i = 1 To 8 Step 1 $rand = Random(1, 4, 1) Send("{CTRLDOWN}") ;Try various methods until we get text on the clipboard Switch $rand Case 1 Send("{INS}") Case 2 ControlSend($window_title, "", "", "{INS}") Case 3 Send("c") Case 4 ControlSend($window_title, "", "", "c^") EndSwitch Send("{CTRLUP}") $readtext = ClipGet() ;Any text on the clipboard? If $readtext <> "" Then Return $readtext EndIf If $i = 4 Then WinActivate($window_title) Sleep(100) EndIf Next Sleep(2000) Return $readtext EndFunc ;==>_GetTextFromActiveWindow Edited June 14, 2016 by t0nZ 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