Jump to content

check if middle button is released


Recommended Posts

hi..i'm trying to write a script that let me easily paste texts from clipboard using the middle mouse button..here's what I've got so far..

#include <Misc.au3>

While 1
    if _IsPressed("04") Then MiddleClickPaste()
    Sleep(250)
WEnd

Func MiddleClickPaste()
    ClipGet()
    If @error <> 1 then
        send ("{CTRLDOWN}v")
        send("{CTRLUP}")
    EndIf
EndFunc

the script runs fine..except that when you press and *hold* the middle button, it keeps pasting texts until you release the button..I want to know if there's way to check if middle button is released..

Edited by TaxiDriver
Link to comment
Share on other sites

#include <Misc.au3>
Dim $Mid=0
While 1
    if _IsPressed("04")&$Mid=0 Then MiddleClickPaste()
    Sleep(250)
WEnd

Func MiddleClickPaste()
    ClipGet()
    If @error <> 1 then
        send ("{CTRLDOWN}v")
        send("{CTRLUP}")
$mid=1
    EndIf
EndFunc

HAVEN't TESTed it!

Link to comment
Share on other sites

tested

#include <Misc.au3>

While 1
    If _IsPressed("04") Then MiddleClickPaste()
    Sleep(250)
WEnd

Func MiddleClickPaste()
    ClipGet()
    If @error <> 1 Then
        Send("{CTRLDOWN}v")
        Send("{CTRLUP}")
    EndIf
    Do
        Sleep(10)
    Until Not _IsPressed("04")
EndFunc   ;==>MiddleClickPaste

[size="1"][font="Arial"].[u].[/u][/font][/size]

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