AutoHotkey usage and examples

This is just a quick post on how to use AutoHotKey, with some examples

Download AutoHotKey from here

Once installed you are ready to start creating and running AutoHotKey scripts, save scripts with the extension .ahk and you can then just double click to run them.

I use AutoHotKey scripts mainly within PowerShell of vbscript

If you want to call your scripts from PowerShell you can use:

& "C:\Program Files\AutoHotkey\AutoHotkey.exe" "C:\Temp\Start.ahk"

 

If you want to call your scripts from vbscript you can use:

Set oWS = CreateObject("WScript.Shell")
sPath = chr(34) & "C:\System\AHK\C:\Temp\Start.ahk" & Chr(34)
errResult = oWS.Run(sPath,,False)

 

A basic example of a script could be:

; make Win+n as a hotkey for launching Notepad
#n::Run Notepad

 

So if you save the above as an .ahk file and then double click on it, pressing Windows key + n will launch notepad

The below script would enter the signature text when you press F6:

; pressing F6 to insert your signature
F8::
Send Best,{Enter}{Enter} Bob Smith
Return

 

Mouse Control

This script will pause for 3 seconds and then move the mouse to the coordinates specified on the screen and then click the left mouse button

sleep, 30000
coordmode, mouse, screen
MouseMove, 1115, 14
MouseClick, l

 

This script will move the mouse to the below screen coordinates, click left, sleep for 4 seconds and then move the mouse.  To get the current coordinates of the mouse cursor right click on the AutoHotKey icon in the taskbar and click Window spy.

coordmode, mouse, screen
MouseClick,, 39, 488,, 0.1
sleep, 4000
MouseMove, 343, 364, 0.1

 

This script will allow you to use your arrow keys as mouse movements

/*
o------------------------------------------------------------o
|Using Keyboard Numpad as a Mouse                            |
|------------------------------------------------------------|
| Keys                  | Description                        |
|------------------------------------------------------------|
| ScrollLock (toggle on)| Activates mouse mode.              |
|-----------------------|------------------------------------|
| Enter              | Left mouse button click.           |
| NumPadenter           | Middle mouse button click.         |
| LeftAlt               | Right mouse button click.          |
| Leftwin + left arrow  | X1 mouse button click. (Win 2k+)   |
| Leftwin + right arrow | X2 mouse button click. (Win 2k+)   |
| Leftwin + up arrow    | Moves up the mouse wheel.          |
| Leftwin + down arrow  | Moves down the mouse wheel.        |
| Arrow Keys            | Moves cursor                       |
|-----------------------|------------------------------------|
| NumPad/ NumPad*       | cursor initial speed               |
| Scrolls Settings      | cursor acceleration                |
|                       | cursor maximum speed               |
|                       | rotation angle to right in degrees.|
|                       | (i.e. 180° = inversed controls).   |
| NumPad- NumPad+       | !wheel initial speed               |
| Adjusts Settings      | !wheel acceleration                |
|                       | !wheel maximum speed               |
|------------------------------------------------------------|
| ! = These options are affected by the mouse wheel speed    |
| adjusted on Control Panel. If you don't have a mouse with  |
| wheel, the default is 3 +/- lines per option button press. |
o------------------------------------------------------------o
*/

;START OF CONFIG SECTION

#SingleInstance force
#MaxHotkeysPerInterval 500

; Using the keyboard hook to implement the Numpad hotkeys prevents
; them from interfering with the generation of ANSI characters such
; as à.  This is because AutoHotkey generates such characters
; by holding down ALT and sending a series of Numpad keystrokes.
; Hook hotkeys are smart enough to ignore such keystrokes.
#UseHook

MouseSpeed = 2
MouseAccelerationSpeed = 18
MouseMaxSpeed = 7

;Mouse wheel speed is also set on Control Panel. As that
;will affect the normal mouse behavior, the real speed of
;these three below are times the normal mouse wheel speed.
MouseWheelSpeed = 1
MouseWheelAccelerationSpeed = 1
MouseWheelMaxSpeed = 5

MouseRotationAngle = 0

;END OF CONFIG SECTION

;This is needed or key presses would faulty send their natural
;actions. Like NumPadDiv would send sometimes "/" to the
;screen.       
#InstallKeybdHook

Temp = 0
Temp2 = 0

MouseRotationAnglePart = %MouseRotationAngle%
;Divide by 45º because MouseMove only supports whole numbers,
;and changing the mouse rotation to a number lesser than 45º
;could make strange movements.
;
;For example: 22.5º when pressing NumPadUp:
;  First it would move upwards until the speed
;  to the side reaches 1.
MouseRotationAnglePart /= 45

MouseCurrentAccelerationSpeed = 0
MouseCurrentSpeed = %MouseSpeed%

MouseWheelCurrentAccelerationSpeed = 0
MouseWheelCurrentSpeed = %MouseSpeed%

SetKeyDelay, -1
SetMouseDelay, -1

Hotkey, Enter, ButtonLeftClick
Hotkey, NumpadEnter, ButtonMiddleClick
Hotkey, lalt, ButtonRightClick
Hotkey, lwin & left, ButtonX1Click
Hotkey, lwin & right, ButtonX2Click

Hotkey, lwin & up, ButtonWheelUp
Hotkey, lwin & down, ButtonWheelDown

Hotkey, up, ButtonUp
Hotkey, Down, ButtonDown
Hotkey, Left, ButtonLeft
Hotkey, Right, ButtonRight

Hotkey, NumpadAdd, ButtonSpeedUp
Hotkey, NumpadSub, ButtonSpeedDown
Hotkey, NumpadMult, ChangeUp
Hotkey, NumpadDiv, ChangeUp6

Gosub, ~ScrollLock  ; Initialize based on current ScrollLock state.
return

;Key activation support

~ScrollLock::
; Wait for it to be released because otherwise the hook state gets reset
; while the key is down, which causes the up-event to get suppressed,
; which in turn prevents toggling of the ScrollLock state/light:
KeyWait, ScrollLock
GetKeyState, ScrollLockState, ScrollLock, T
If ScrollLockState = D
{
	Hotkey, lwin & up, on
        Hotkey, NumpadEnter, on
        Hotkey, lwin & down, on
        Hotkey, lwin & left, on
        Hotkey, lwin & right, on

        Hotkey, lalt, on
        Hotkey, Enter, on

	Hotkey, up, on
	Hotkey, Down, on
	Hotkey, Left, on
	Hotkey, Right, on

        Hotkey, NumpadAdd, on
	Hotkey, NumpadSub, on
	Hotkey, NumpadMult, on
	Hotkey, NumpadDiv, on


}
else
{
	Hotkey, lwin & up, off
        Hotkey, NumpadEnter, off
        Hotkey, lwin & down, off
        Hotkey, lwin & left, off
        Hotkey, lwin & right, off
        Hotkey, lalt, off
        Hotkey, Enter, off
	
        Hotkey, up, off
	Hotkey, Down, off
	Hotkey, Left, off
	Hotkey, Right, off

        Hotkey, NumpadAdd, off
	Hotkey, NumpadSub, off
	Hotkey, NumpadMult, off
	Hotkey, NumpadDiv, off



}
return

ChangeUp:
ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixels
Hotkey, NumpadAdd, ButtonAccelerationSpeedUp
Hotkey, NumpadSub, ButtonAccelerationSpeedDown
Hotkey, NumpadMult, ChangeUp2
Hotkey, NumpadDiv, ChangeUp6
return

ChangeUp2:
ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixels
Hotkey, NumpadAdd, ButtonMaxSpeedUp
Hotkey, NumpadSub, ButtonMaxSpeedDown
Hotkey, NumpadMult, ChangeUp3
Hotkey, NumpadDiv, ChangeUp
return

ChangeUp3:
ToolTip, Mouse rotation angle: %MouseRotationAngle%°
Hotkey, NumpadAdd, ButtonRotationAngleUp
Hotkey, NumpadSub, ButtonRotationAngleDown
Hotkey, NumpadMult, ChangeUp4
Hotkey, NumpadDiv, ChangeUp2
return

ChangeUp4:
ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% lines
Hotkey, NumpadAdd, ButtonWheelSpeedUp
Hotkey, NumpadSub, ButtonWheelSpeedDown
Hotkey, NumpadMult, ChangeUp5
Hotkey, NumpadDiv, ChangeUp3
return

ChangeUp5:
ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% lines
Hotkey, NumpadAdd, ButtonWheelAccelerationSpeedUp
Hotkey, NumpadSub, ButtonWheelAccelerationSpeedDown
Hotkey, NumpadMult, ChangeUp6
Hotkey, NumpadDiv, ChangeUp4
return

ChangeUp6:
ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% lines
Hotkey, NumpadAdd, ButtonWheelMaxSpeedUp
Hotkey, NumpadSub, ButtonWheelMaxSpeedDown
Hotkey, NumpadMult, ChangeUp7
Hotkey, NumpadDiv, ChangeUp5
return

ChangeUp7:
ToolTip, Mouse speed: %MouseSpeed% pixels
Hotkey, NumpadAdd, ButtonSpeedUp
Hotkey, NumpadSub, ButtonSpeedDown
Hotkey, NumpadMult, ChangeUp
Hotkey, NumpadDiv, ChangeUp6
return

;Mouse click support

ButtonLeftClick:
GetKeyState, already_down_state, LButton
If already_down_state = D
	return
Button2 = Enter
ButtonClick = Left
Goto ButtonClickStart

ButtonMiddleClick:
GetKeyState, already_down_state, MButton
If already_down_state = D
	return
Button2 = NumpadEnter
ButtonClick = Middle
Goto ButtonClickStart

ButtonRightClick:
GetKeyState, already_down_state, RButton
If already_down_state = D
	return
Button2 = lalt
ButtonClick = Right
Goto ButtonClickStart

ButtonX1Click:
GetKeyState, already_down_state, XButton1
If already_down_state = D
	return
Button2 = lwin & left
ButtonClick = X1
Goto ButtonClickStart

ButtonX2Click:
GetKeyState, already_down_state, XButton2
If already_down_state = D
	return
Button2 = lwin & right
ButtonClick = X2
Goto ButtonClickStart

ButtonClickStart:
MouseClick, %ButtonClick%,,, 1, 0, D
SetTimer, ButtonClickEnd, 10
return

ButtonClickEnd:
GetKeyState, kclickstate, %Button2%, P
if kclickstate = D
	return

SetTimer, ButtonClickEnd, off
MouseClick, %ButtonClick%,,, 1, 0, U
return

donoth:
return

;Mouse movement support

ButtonSpeedUp:
MouseSpeed++
ToolTip, Mouse speed: %MouseSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonSpeedDown:
If MouseSpeed > 1
	MouseSpeed--
If MouseSpeed = 1
	ToolTip, Mouse speed: %MouseSpeed% pixel
else
	ToolTip, Mouse speed: %MouseSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonAccelerationSpeedUp:
MouseAccelerationSpeed++
ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonAccelerationSpeedDown:
If MouseAccelerationSpeed > 1
	MouseAccelerationSpeed--
If MouseAccelerationSpeed = 1
	ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixel
else
	ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixels
SetTimer, RemoveToolTip, 1000
return

ButtonMaxSpeedUp:
MouseMaxSpeed++
ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonMaxSpeedDown:
If MouseMaxSpeed > 1
	MouseMaxSpeed--
If MouseMaxSpeed = 1
	ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixel
else
	ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixels
SetTimer, RemoveToolTip, 1000
return

ButtonRotationAngleUp:
MouseRotationAnglePart++
If MouseRotationAnglePart >= 8
	MouseRotationAnglePart = 0
MouseRotationAngle = %MouseRotationAnglePart%
MouseRotationAngle *= 45
ToolTip, Mouse rotation angle: %MouseRotationAngle%°
SetTimer, RemoveToolTip, 1000
return
ButtonRotationAngleDown:
MouseRotationAnglePart--
If MouseRotationAnglePart < 0
	MouseRotationAnglePart = 7
MouseRotationAngle = %MouseRotationAnglePart%
MouseRotationAngle *= 45
ToolTip, Mouse rotation angle: %MouseRotationAngle%°
SetTimer, RemoveToolTip, 1000
return

ButtonUp:
ButtonDown:
ButtonLeft:
ButtonRight:
ButtonUpLeft:
ButtonUpRight:
ButtonDownLeft:
ButtonDownRight:
;If Button <> 0
;{
;	IfNotInString, A_ThisHotkey, %Button%
;	{
;		MouseCurrentAccelerationSpeed = 0
;		MouseCurrentSpeed = %MouseSpeed%
;	}
;}
StringReplace, Button, A_ThisHotkey, *

ButtonAccelerationStart:
If MouseAccelerationSpeed >= 1
{
	If MouseMaxSpeed > %MouseCurrentSpeed%
	{
		Temp = 0.001
		Temp *= %MouseAccelerationSpeed%
		MouseCurrentAccelerationSpeed += %Temp%
		MouseCurrentSpeed += %MouseCurrentAccelerationSpeed%
	}
}

;MouseRotationAngle convertion to speed of button direction
{
	MouseCurrentSpeedToDirection = %MouseRotationAngle%
	MouseCurrentSpeedToDirection /= 90.0
	Temp = %MouseCurrentSpeedToDirection%

	if Temp >= 0
	{
		if Temp < 1
		{
			MouseCurrentSpeedToDirection = 1
			MouseCurrentSpeedToDirection -= %Temp%
			Goto EndMouseCurrentSpeedToDirectionCalculation
		}
	}
	if Temp >= 1
	{
		if Temp < 2
		{
			MouseCurrentSpeedToDirection = 0
			Temp -= 1
			MouseCurrentSpeedToDirection -= %Temp%
			Goto EndMouseCurrentSpeedToDirectionCalculation
		}
	}
	if Temp >= 2
	{
		if Temp < 3
		{
			MouseCurrentSpeedToDirection = -1
			Temp -= 2
			MouseCurrentSpeedToDirection += %Temp%
			Goto EndMouseCurrentSpeedToDirectionCalculation
		}
	}
	if Temp >= 3
	{
		if Temp < 4
		{
			MouseCurrentSpeedToDirection = 0
			Temp -= 3
			MouseCurrentSpeedToDirection += %Temp%
			Goto EndMouseCurrentSpeedToDirectionCalculation
		}
	}
}
EndMouseCurrentSpeedToDirectionCalculation:

;MouseRotationAngle convertion to speed of 90 degrees to right
{
	MouseCurrentSpeedToSide = %MouseRotationAngle%
	MouseCurrentSpeedToSide /= 90.0
	Temp = %MouseCurrentSpeedToSide%
	Transform, Temp, mod, %Temp%, 4

	if Temp >= 0
	{
		if Temp < 1
		{
			MouseCurrentSpeedToSide = 0
			MouseCurrentSpeedToSide += %Temp%
			Goto EndMouseCurrentSpeedToSideCalculation
		}
	}
	if Temp >= 1
	{
		if Temp < 2
		{
			MouseCurrentSpeedToSide = 1
			Temp -= 1
			MouseCurrentSpeedToSide -= %Temp%
			Goto EndMouseCurrentSpeedToSideCalculation
		}
	}
	if Temp >= 2
	{
		if Temp < 3
		{
			MouseCurrentSpeedToSide = 0
			Temp -= 2
			MouseCurrentSpeedToSide -= %Temp%
			Goto EndMouseCurrentSpeedToSideCalculation
		}
	}
	if Temp >= 3
	{
		if Temp < 4
		{
			MouseCurrentSpeedToSide = -1
			Temp -= 3
			MouseCurrentSpeedToSide += %Temp%
			Goto EndMouseCurrentSpeedToSideCalculation
		}
	}
}
EndMouseCurrentSpeedToSideCalculation: 

MouseCurrentSpeedToDirection *= %MouseCurrentSpeed% 
MouseCurrentSpeedToSide *= %MouseCurrentSpeed% 

Temp1 = %MouseRotationAnglePart% 
Transform, Temp1, Mod, %Temp1%, 2 

BackupMouseCurrentSpeedToSide := MouseCurrentSpeedToSide 
BackupMouseCurrentSpeedToDirection := MouseCurrentSpeedToDirection 
GetKeyState, tempstate, up, P 
If (Button = "up" or tempstate = "D") 
{ 
   if Temp1 = 1 
   { 
      MouseCurrentSpeedToSide *= 2 
      MouseCurrentSpeedToDirection *= 2 
   } 

   MouseCurrentSpeedToDirection *= -1 
   MouseMove, %MouseCurrentSpeedToSide%, %MouseCurrentSpeedToDirection%, 0, R 
} 
MouseCurrentSpeedToSide := BackupMouseCurrentSpeedToSide 
MouseCurrentSpeedToDirection := BackupMouseCurrentSpeedToDirection 
GetKeyState, tempstate, Down, P 
If (Button = "Down" or tempstate = "D") 
{ 
   if Temp1 = 1 
   { 
      MouseCurrentSpeedToSide *= 2 
      MouseCurrentSpeedToDirection *= 2 
   } 

   MouseCurrentSpeedToSide *= -1 
   MouseMove, %MouseCurrentSpeedToSide%, %MouseCurrentSpeedToDirection%, 0, R 
} 
MouseCurrentSpeedToSide := BackupMouseCurrentSpeedToSide 
MouseCurrentSpeedToDirection := BackupMouseCurrentSpeedToDirection 
GetKeyState, tempstate, Left, P 
If (Button = "Left" or tempstate = "D") 
{ 
   if Temp1 = 1 
   { 
      MouseCurrentSpeedToSide *= 2 
      MouseCurrentSpeedToDirection *= 2 
   } 

   MouseCurrentSpeedToSide *= -1 
   MouseCurrentSpeedToDirection *= -1 

   MouseMove, %MouseCurrentSpeedToDirection%, %MouseCurrentSpeedToSide%, 0, R 
} 
MouseCurrentSpeedToSide := BackupMouseCurrentSpeedToSide 
MouseCurrentSpeedToDirection := BackupMouseCurrentSpeedToDirection 
GetKeyState, tempstate, Right, P 
If (Button = "Right" or tempstate = "D") 
{ 
   if Temp1 = 1 
   { 
      MouseCurrentSpeedToSide *= 2 
      MouseCurrentSpeedToDirection *= 2 
   } 

   MouseMove, %MouseCurrentSpeedToDirection%, %MouseCurrentSpeedToSide%, 0, R 
} 


SetTimer, ButtonAccelerationEnd, 10 
return 

ButtonAccelerationEnd: 
GetKeyState, state, %Button%, P 
GetKeyState, isUp, up, P 
GetKeyState, isDown, Down, P 
GetKeyState, isLeft, Left, P 
GetKeyState, isRight, Right, P 
if state = D ; not end if key is held 
   Goto ButtonAccelerationStart 
Button = 0 ; reset since last key not held 
if (isUp = "D" or isDown = "D" or isLeft = "D" or isRight = "D") ; not end if any key is held 
   Goto ButtonAccelerationStart 
SetTimer, ButtonAccelerationEnd, off 
MouseCurrentAccelerationSpeed = 0 
MouseCurrentSpeed = %MouseSpeed% 
return 


;Mouse wheel movement support

ButtonWheelSpeedUp:
MouseWheelSpeed++
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
	MouseWheelSpeedMultiplier = 1
MouseWheelSpeedReal = %MouseWheelSpeed%
MouseWheelSpeedReal *= %MouseWheelSpeedMultiplier%
ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelSpeedDown:
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
	MouseWheelSpeedMultiplier = 1
If MouseWheelSpeedReal > %MouseWheelSpeedMultiplier%
{
	MouseWheelSpeed--
	MouseWheelSpeedReal = %MouseWheelSpeed%
	MouseWheelSpeedReal *= %MouseWheelSpeedMultiplier%
}
If MouseWheelSpeedReal = 1
	ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% line
else
	ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return

ButtonWheelAccelerationSpeedUp:
MouseWheelAccelerationSpeed++
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
	MouseWheelSpeedMultiplier = 1
MouseWheelAccelerationSpeedReal = %MouseWheelAccelerationSpeed%
MouseWheelAccelerationSpeedReal *= %MouseWheelSpeedMultiplier%
ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelAccelerationSpeedDown:
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
	MouseWheelSpeedMultiplier = 1
If MouseWheelAccelerationSpeed > 1
{
	MouseWheelAccelerationSpeed--
	MouseWheelAccelerationSpeedReal = %MouseWheelAccelerationSpeed%
	MouseWheelAccelerationSpeedReal *= %MouseWheelSpeedMultiplier%
}
If MouseWheelAccelerationSpeedReal = 1
	ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% line
else
	ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return

ButtonWheelMaxSpeedUp:
MouseWheelMaxSpeed++
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
	MouseWheelSpeedMultiplier = 1
MouseWheelMaxSpeedReal = %MouseWheelMaxSpeed%
MouseWheelMaxSpeedReal *= %MouseWheelSpeedMultiplier%
ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelMaxSpeedDown:
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
	MouseWheelSpeedMultiplier = 1
If MouseWheelMaxSpeed > 1
{
	MouseWheelMaxSpeed--
	MouseWheelMaxSpeedReal = %MouseWheelMaxSpeed%
	MouseWheelMaxSpeedReal *= %MouseWheelSpeedMultiplier%
}
If MouseWheelMaxSpeedReal = 1
	ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% line
else
	ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return

ButtonWheelUp:
ButtonWheelDown:

If Button <> 0
{
	If Button <> %A_ThisHotkey%
	{
		MouseWheelCurrentAccelerationSpeed = 0
		MouseWheelCurrentSpeed = %MouseWheelSpeed%
	}
}
StringReplace, Button, A_ThisHotkey, *

ButtonWheelAccelerationStart:
If MouseWheelAccelerationSpeed >= 1
{
	If MouseWheelMaxSpeed > %MouseWheelCurrentSpeed%
	{
		Temp = 0.001
		Temp *= %MouseWheelAccelerationSpeed%
		MouseWheelCurrentAccelerationSpeed += %Temp%
		MouseWheelCurrentSpeed += %MouseWheelCurrentAccelerationSpeed%
	}
}

If Button = lwin & up
	MouseClick, wheelup,,, %MouseWheelCurrentSpeed%, 0, D
else if Button = lwin & down
	MouseClick, wheeldown,,, %MouseWheelCurrentSpeed%, 0, D

SetTimer, ButtonWheelAccelerationEnd, 100
return

ButtonWheelAccelerationEnd:
GetKeyState, kstate, %Button%, P
if kstate = D
	Goto ButtonWheelAccelerationStart

MouseWheelCurrentAccelerationSpeed = 0
MouseWheelCurrentSpeed = %MouseWheelSpeed%
Button = 0
return

RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return

Leave a Reply

Your email address will not be published. Required fields are marked *