Jump to content
Sign in to follow this  
pablo14170

autoit want this monitor

Recommended Posts

pablo14170

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.

Share this post


Link to post
Share on other sites
pablo14170

It must be before copy.
It must be when text is selected

Share this post


Link to post
Share on other sites
argumentum

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

But that is the idea B)

And welcome to the forums ;) , hope you learn this language, is quite rewarding.

Share this post


Link to post
Share on other sites
t0nZ

I do not remember who to thank sincerely for this, but I use it in various scripts, it works like a charm:

Func _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 by t0nZ

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.