Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Cut and paste with the mouse.

  • Please log in to reply
3 replies to this topic
  • Members
  • 3 posts
  • Last active: May 05 2005 10:12 PM
  • Joined: 09 Jul 2004
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.

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

MButton:: ; Make the middle mouse button a hotkey, and _don't_ allow it to function as normal.
send, ^v ; Paste

  • Members
  • 68 posts
  • Last active: Feb 06 2005 05:55 PM
  • Joined: 19 Jun 2004
i like the feature when i'm using mIRC

nice to know i can use it in any program now

when finding the difference between the before and after mouse positions you could make the vertical require less difference than the horizontal

or you could use the pythagorean theorem to find the hypoteneuse

or both
AHK = Hella fun

  • Members
  • 207 posts
  • Last active: Jul 03 2008 03:12 AM
  • Joined: 02 Jul 2004
Wow, I bet this would make linux junkies who have to use windows happy. I'll have to show this to my professor when I go back to school.

  • Guests
  • Last active:
  • Joined: --
It work's good :), but I change MButton to ~MButton.