Barky
Joined: 09 Jul 2004 Posts: 3
|
Posted: Fri Jul 09, 2004 3:58 am Post subject: Cut and paste with the mouse. |
|
|
This script automatically copies any mouse selection made with the left mouse button, and makes the middle mouse button function as a 'paste' command. Instead of sending a copy command every time the left button is pressed, it checks to see if there was a significant change in the position of the mouse cursor between the button push and the button release (signifying that the mouse was used to make a selection). Leave a comment if you like it... or hate it.
--Barky
| Code: |
~LButton:: ; Make the left mouse button a hotkey, but allow it to function as normal.
MouseGetPos, xA, yA
loop ; Begin a loop.
{
Sleep, 10 ; Wait 10 milliseconds.
GetKeyState, LButton_state, LButton, P ; Check on the status of the left mouse button.
if LButton_state = U ; If the left mouse button has been released.
{
MouseGetPos, xB, yB
Transform, xA, abs, %xA% ; Return the absolute value of xA.
Transform, xB, abs, %xB%
Transform, yA, abs, %yA%
Transform, yB, abs, %yB%
xDiff = 0
xDiff += %xA% ; Add xA to xDiff.
xDiff -= %xB% ; Subtract xA from xDiff.
Transform, xDiff, abs, %xDiff%
yDiff = 0
yDiff += %yA%
yDiff -= %yB%
Transform, yDiff, abs, %yDiff%
diffSum = 0
diffSum += %xDiff%
diffSum += %yDiff%
If diffSum > 10
{
Send, ^c ; Copy.
clipboard = %clipboard% ; Convert the cliboard contents to plain text.
}
break
}
}
return
MButton:: ; Make the middle mouse button a hotkey, and _don't_ allow it to function as normal.
send, ^v ; Paste
return
|
|
|