PageRenderTime 31ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/AutoHotkey.docset/Contents/Resources/Documents/scripts/NumpadMouse.htm

https://gitlab.com/ahkscript/Autohotkey.docset
HTML | 767 lines | 690 code | 77 blank | 0 comment | 0 complexity | fee98697e40e01d22b501163424f1a23 MD5 | raw file
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Using Keyboard Numpad as a Mouse -- by deguix</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <link href="../static/theme.css" rel="stylesheet" type="text/css" />
  8. <script src="../static/content.js" type="text/javascript"></script>
  9. </head>
  10. <body>
  11. <h1>Using Keyboard Numpad as a Mouse -- by deguix</h1>
  12. <p>This script makes mousing with your keyboard almost as easy
  13. as using a real mouse (maybe even easier for some tasks).
  14. It supports up to five mouse buttons and the turning of the
  15. mouse wheel. It also features customizable movement speed,
  16. acceleration, and &quot;axis inversion&quot;.
  17. </p>
  18. <p><a href="NumpadMouse.ahk">Download This Script</a> &nbsp;| &nbsp;<a href="index.htm">Other Sample Scripts</a> &nbsp;| &nbsp;<a href="../AutoHotkey.htm">Home</a></p>
  19. <pre class="NoIndent"><em>/*
  20. o------------------------------------------------------------o
  21. |Using Keyboard Numpad as a Mouse |
  22. (------------------------------------------------------------)
  23. | By deguix / A Script file for AutoHotkey 1.0.22+ |
  24. | ----------------------------------------|
  25. | |
  26. | This script is an example of use of AutoHotkey. It uses |
  27. | the remapping of numpad keys of a keyboard to transform it |
  28. | into a mouse. Some features are the acceleration which |
  29. | enables you to increase the mouse movement when holding |
  30. | a key for a long time, and the rotation which makes the |
  31. | numpad mouse to &quot;turn&quot;. I.e. NumPadDown as NumPadUp |
  32. | and vice-versa. See the list of keys used below: |
  33. | |
  34. |------------------------------------------------------------|
  35. | Keys | Description |
  36. |------------------------------------------------------------|
  37. | ScrollLock (toggle on)| Activates numpad mouse mode. |
  38. |-----------------------|------------------------------------|
  39. | NumPad0 | Left mouse button click. |
  40. | NumPad5 | Middle mouse button click. |
  41. | NumPadDot | Right mouse button click. |
  42. | NumPadDiv/NumPadMult | X1/X2 mouse button click. (Win 2k+)|
  43. | NumPadSub/NumPadAdd | Moves up/down the mouse wheel. |
  44. | | |
  45. |-----------------------|------------------------------------|
  46. | NumLock (toggled off) | Activates mouse movement mode. |
  47. |-----------------------|------------------------------------|
  48. | NumPadEnd/Down/PgDn/ | Mouse movement. |
  49. | /Left/Right/Home/Up/ | |
  50. | /PgUp | |
  51. | | |
  52. |-----------------------|------------------------------------|
  53. | NumLock (toggled on) | Activates mouse speed adj. mode. |
  54. |-----------------------|------------------------------------|
  55. | NumPad7/NumPad1 | Inc./dec. acceleration per |
  56. | | button press. |
  57. | NumPad8/NumPad2 | Inc./dec. initial speed per |
  58. | | button press. |
  59. | NumPad9/NumPad3 | Inc./dec. maximum speed per |
  60. | | button press. |
  61. | ^NumPad7/^NumPad1 | Inc./dec. wheel acceleration per |
  62. | | button press*. |
  63. | ^NumPad8/^NumPad2 | Inc./dec. wheel initial speed per |
  64. | | button press*. |
  65. | ^NumPad9/^NumPad3 | Inc./dec. wheel maximum speed per |
  66. | | button press*. |
  67. | NumPad4/NumPad6 | Inc./dec. rotation angle to |
  68. | | right in degrees. (i.e. 180&deg; = |
  69. | | = inversed controls). |
  70. |------------------------------------------------------------|
  71. | * = These options are affected by the mouse wheel speed |
  72. | adjusted on Control Panel. If you don't have a mouse with |
  73. | wheel, the default is 3 +/- lines per option button press. |
  74. o------------------------------------------------------------o
  75. */</em>
  76. <em>;START OF CONFIG SECTION</em>
  77. #SingleInstance force
  78. #MaxHotkeysPerInterval 500
  79. <em>; Using the keyboard hook to implement the Numpad hotkeys prevents
  80. ; them from interfering with the generation of ANSI characters such
  81. ; as &agrave;. This is because AutoHotkey generates such characters
  82. ; by holding down ALT and sending a series of Numpad keystrokes.
  83. ; Hook hotkeys are smart enough to ignore such keystrokes.</em>
  84. #UseHook
  85. MouseSpeed = 1
  86. MouseAccelerationSpeed = 1
  87. MouseMaxSpeed = 5
  88. <em>;Mouse wheel speed is also set on Control Panel. As that
  89. ;will affect the normal mouse behavior, the real speed of
  90. ;these three below are times the normal mouse wheel speed.</em>
  91. MouseWheelSpeed = 1
  92. MouseWheelAccelerationSpeed = 1
  93. MouseWheelMaxSpeed = 5
  94. MouseRotationAngle = 0
  95. <em>;END OF CONFIG SECTION</em>
  96. <em>;This is needed or key presses would faulty send their natural
  97. ;actions. Like NumPadDiv would send sometimes &quot;/&quot; to the
  98. ;screen.</em>
  99. #InstallKeybdHook
  100. Temp = 0
  101. Temp2 = 0
  102. MouseRotationAnglePart = %MouseRotationAngle%
  103. <em>;Divide by 45&ordm; because MouseMove only supports whole numbers,
  104. ;and changing the mouse rotation to a number lesser than 45&ordm;
  105. ;could make strange movements.
  106. ;
  107. ;For example: 22.5&ordm; when pressing NumPadUp:
  108. ; First it would move upwards until the speed
  109. ; to the side reaches 1.</em>
  110. MouseRotationAnglePart /= 45
  111. MouseCurrentAccelerationSpeed = 0
  112. MouseCurrentSpeed = %MouseSpeed%
  113. MouseWheelCurrentAccelerationSpeed = 0
  114. MouseWheelCurrentSpeed = %MouseSpeed%
  115. SetKeyDelay, -1
  116. SetMouseDelay, -1
  117. Hotkey, *NumPad0, ButtonLeftClick
  118. Hotkey, *NumpadIns, ButtonLeftClickIns
  119. Hotkey, *NumPad5, ButtonMiddleClick
  120. Hotkey, *NumpadClear, ButtonMiddleClickClear
  121. Hotkey, *NumPadDot, ButtonRightClick
  122. Hotkey, *NumPadDel, ButtonRightClickDel
  123. Hotkey, *NumPadDiv, ButtonX1Click
  124. Hotkey, *NumPadMult, ButtonX2Click
  125. Hotkey, *NumpadSub, ButtonWheelUp
  126. Hotkey, *NumpadAdd, ButtonWheelDown
  127. Hotkey, *NumPadUp, ButtonUp
  128. Hotkey, *NumPadDown, ButtonDown
  129. Hotkey, *NumPadLeft, ButtonLeft
  130. Hotkey, *NumPadRight, ButtonRight
  131. Hotkey, *NumPadHome, ButtonUpLeft
  132. Hotkey, *NumPadEnd, ButtonUpRight
  133. Hotkey, *NumPadPgUp, ButtonDownLeft
  134. Hotkey, *NumPadPgDn, ButtonDownRight
  135. Hotkey, Numpad8, ButtonSpeedUp
  136. Hotkey, Numpad2, ButtonSpeedDown
  137. Hotkey, Numpad7, ButtonAccelerationSpeedUp
  138. Hotkey, Numpad1, ButtonAccelerationSpeedDown
  139. Hotkey, Numpad9, ButtonMaxSpeedUp
  140. Hotkey, Numpad3, ButtonMaxSpeedDown
  141. Hotkey, Numpad6, ButtonRotationAngleUp
  142. Hotkey, Numpad4, ButtonRotationAngleDown
  143. Hotkey, !Numpad8, ButtonWheelSpeedUp
  144. Hotkey, !Numpad2, ButtonWheelSpeedDown
  145. Hotkey, !Numpad7, ButtonWheelAccelerationSpeedUp
  146. Hotkey, !Numpad1, ButtonWheelAccelerationSpeedDown
  147. Hotkey, !Numpad9, ButtonWheelMaxSpeedUp
  148. Hotkey, !Numpad3, ButtonWheelMaxSpeedDown
  149. Gosub, ~ScrollLock <em>; Initialize based on current ScrollLock state.</em>
  150. return
  151. <em>;Key activation support</em>
  152. ~ScrollLock::
  153. <em>; Wait for it to be released because otherwise the hook state gets reset
  154. ; while the key is down, which causes the up-event to get suppressed,
  155. ; which in turn prevents toggling of the ScrollLock state/light:</em>
  156. KeyWait, ScrollLock
  157. GetKeyState, ScrollLockState, ScrollLock, T
  158. If ScrollLockState = D
  159. {
  160. Hotkey, *NumPad0, on
  161. Hotkey, *NumpadIns, on
  162. Hotkey, *NumPad5, on
  163. Hotkey, *NumPadDot, on
  164. Hotkey, *NumPadDel, on
  165. Hotkey, *NumPadDiv, on
  166. Hotkey, *NumPadMult, on
  167. Hotkey, *NumpadSub, on
  168. Hotkey, *NumpadAdd, on
  169. Hotkey, *NumPadUp, on
  170. Hotkey, *NumPadDown, on
  171. Hotkey, *NumPadLeft, on
  172. Hotkey, *NumPadRight, on
  173. Hotkey, *NumPadHome, on
  174. Hotkey, *NumPadEnd, on
  175. Hotkey, *NumPadPgUp, on
  176. Hotkey, *NumPadPgDn, on
  177. Hotkey, Numpad8, on
  178. Hotkey, Numpad2, on
  179. Hotkey, Numpad7, on
  180. Hotkey, Numpad1, on
  181. Hotkey, Numpad9, on
  182. Hotkey, Numpad3, on
  183. Hotkey, Numpad6, on
  184. Hotkey, Numpad4, on
  185. Hotkey, !Numpad8, on
  186. Hotkey, !Numpad2, on
  187. Hotkey, !Numpad7, on
  188. Hotkey, !Numpad1, on
  189. Hotkey, !Numpad9, on
  190. Hotkey, !Numpad3, on
  191. }
  192. else
  193. {
  194. Hotkey, *NumPad0, off
  195. Hotkey, *NumpadIns, off
  196. Hotkey, *NumPad5, off
  197. Hotkey, *NumPadDot, off
  198. Hotkey, *NumPadDel, off
  199. Hotkey, *NumPadDiv, off
  200. Hotkey, *NumPadMult, off
  201. Hotkey, *NumpadSub, off
  202. Hotkey, *NumpadAdd, off
  203. Hotkey, *NumPadUp, off
  204. Hotkey, *NumPadDown, off
  205. Hotkey, *NumPadLeft, off
  206. Hotkey, *NumPadRight, off
  207. Hotkey, *NumPadHome, off
  208. Hotkey, *NumPadEnd, off
  209. Hotkey, *NumPadPgUp, off
  210. Hotkey, *NumPadPgDn, off
  211. Hotkey, Numpad8, off
  212. Hotkey, Numpad2, off
  213. Hotkey, Numpad7, off
  214. Hotkey, Numpad1, off
  215. Hotkey, Numpad9, off
  216. Hotkey, Numpad3, off
  217. Hotkey, Numpad6, off
  218. Hotkey, Numpad4, off
  219. Hotkey, !Numpad8, off
  220. Hotkey, !Numpad2, off
  221. Hotkey, !Numpad7, off
  222. Hotkey, !Numpad1, off
  223. Hotkey, !Numpad9, off
  224. Hotkey, !Numpad3, off
  225. }
  226. return
  227. <em>;Mouse click support</em>
  228. ButtonLeftClick:
  229. GetKeyState, already_down_state, LButton
  230. If already_down_state = D
  231. return
  232. Button2 = NumPad0
  233. ButtonClick = Left
  234. Goto ButtonClickStart
  235. ButtonLeftClickIns:
  236. GetKeyState, already_down_state, LButton
  237. If already_down_state = D
  238. return
  239. Button2 = NumPadIns
  240. ButtonClick = Left
  241. Goto ButtonClickStart
  242. ButtonMiddleClick:
  243. GetKeyState, already_down_state, MButton
  244. If already_down_state = D
  245. return
  246. Button2 = NumPad5
  247. ButtonClick = Middle
  248. Goto ButtonClickStart
  249. ButtonMiddleClickClear:
  250. GetKeyState, already_down_state, MButton
  251. If already_down_state = D
  252. return
  253. Button2 = NumPadClear
  254. ButtonClick = Middle
  255. Goto ButtonClickStart
  256. ButtonRightClick:
  257. GetKeyState, already_down_state, RButton
  258. If already_down_state = D
  259. return
  260. Button2 = NumPadDot
  261. ButtonClick = Right
  262. Goto ButtonClickStart
  263. ButtonRightClickDel:
  264. GetKeyState, already_down_state, RButton
  265. If already_down_state = D
  266. return
  267. Button2 = NumPadDel
  268. ButtonClick = Right
  269. Goto ButtonClickStart
  270. ButtonX1Click:
  271. GetKeyState, already_down_state, XButton1
  272. If already_down_state = D
  273. return
  274. Button2 = NumPadDiv
  275. ButtonClick = X1
  276. Goto ButtonClickStart
  277. ButtonX2Click:
  278. GetKeyState, already_down_state, XButton2
  279. If already_down_state = D
  280. return
  281. Button2 = NumPadMult
  282. ButtonClick = X2
  283. Goto ButtonClickStart
  284. ButtonClickStart:
  285. MouseClick, %ButtonClick%,,, 1, 0, D
  286. SetTimer, ButtonClickEnd, 10
  287. return
  288. ButtonClickEnd:
  289. GetKeyState, kclickstate, %Button2%, P
  290. if kclickstate = D
  291. return
  292. SetTimer, ButtonClickEnd, off
  293. MouseClick, %ButtonClick%,,, 1, 0, U
  294. return
  295. <em>;Mouse movement support</em>
  296. ButtonSpeedUp:
  297. MouseSpeed++
  298. ToolTip, Mouse speed: %MouseSpeed% pixels
  299. SetTimer, RemoveToolTip, 1000
  300. return
  301. ButtonSpeedDown:
  302. If MouseSpeed &gt; 1
  303. MouseSpeed--
  304. If MouseSpeed = 1
  305. ToolTip, Mouse speed: %MouseSpeed% pixel
  306. else
  307. ToolTip, Mouse speed: %MouseSpeed% pixels
  308. SetTimer, RemoveToolTip, 1000
  309. return
  310. ButtonAccelerationSpeedUp:
  311. MouseAccelerationSpeed++
  312. ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixels
  313. SetTimer, RemoveToolTip, 1000
  314. return
  315. ButtonAccelerationSpeedDown:
  316. If MouseAccelerationSpeed &gt; 1
  317. MouseAccelerationSpeed--
  318. If MouseAccelerationSpeed = 1
  319. ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixel
  320. else
  321. ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixels
  322. SetTimer, RemoveToolTip, 1000
  323. return
  324. ButtonMaxSpeedUp:
  325. MouseMaxSpeed++
  326. ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixels
  327. SetTimer, RemoveToolTip, 1000
  328. return
  329. ButtonMaxSpeedDown:
  330. If MouseMaxSpeed &gt; 1
  331. MouseMaxSpeed--
  332. If MouseMaxSpeed = 1
  333. ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixel
  334. else
  335. ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixels
  336. SetTimer, RemoveToolTip, 1000
  337. return
  338. ButtonRotationAngleUp:
  339. MouseRotationAnglePart++
  340. If MouseRotationAnglePart &gt;= 8
  341. MouseRotationAnglePart = 0
  342. MouseRotationAngle = %MouseRotationAnglePart%
  343. MouseRotationAngle *= 45
  344. ToolTip, Mouse rotation angle: %MouseRotationAngle%&deg;
  345. SetTimer, RemoveToolTip, 1000
  346. return
  347. ButtonRotationAngleDown:
  348. MouseRotationAnglePart--
  349. If MouseRotationAnglePart &lt; 0
  350. MouseRotationAnglePart = 7
  351. MouseRotationAngle = %MouseRotationAnglePart%
  352. MouseRotationAngle *= 45
  353. ToolTip, Mouse rotation angle: %MouseRotationAngle%&deg;
  354. SetTimer, RemoveToolTip, 1000
  355. return
  356. ButtonUp:
  357. ButtonDown:
  358. ButtonLeft:
  359. ButtonRight:
  360. ButtonUpLeft:
  361. ButtonUpRight:
  362. ButtonDownLeft:
  363. ButtonDownRight:
  364. If Button &lt;&gt; 0
  365. {
  366. IfNotInString, A_ThisHotkey, %Button%
  367. {
  368. MouseCurrentAccelerationSpeed = 0
  369. MouseCurrentSpeed = %MouseSpeed%
  370. }
  371. }
  372. StringReplace, Button, A_ThisHotkey, *
  373. ButtonAccelerationStart:
  374. If MouseAccelerationSpeed &gt;= 1
  375. {
  376. If MouseMaxSpeed &gt; %MouseCurrentSpeed%
  377. {
  378. Temp = 0.001
  379. Temp *= %MouseAccelerationSpeed%
  380. MouseCurrentAccelerationSpeed += %Temp%
  381. MouseCurrentSpeed += %MouseCurrentAccelerationSpeed%
  382. }
  383. }
  384. <em>;MouseRotationAngle convertion to speed of button direction</em>
  385. {
  386. MouseCurrentSpeedToDirection = %MouseRotationAngle%
  387. MouseCurrentSpeedToDirection /= 90.0
  388. Temp = %MouseCurrentSpeedToDirection%
  389. if Temp &gt;= 0
  390. {
  391. if Temp &lt; 1
  392. {
  393. MouseCurrentSpeedToDirection = 1
  394. MouseCurrentSpeedToDirection -= %Temp%
  395. Goto EndMouseCurrentSpeedToDirectionCalculation
  396. }
  397. }
  398. if Temp &gt;= 1
  399. {
  400. if Temp &lt; 2
  401. {
  402. MouseCurrentSpeedToDirection = 0
  403. Temp -= 1
  404. MouseCurrentSpeedToDirection -= %Temp%
  405. Goto EndMouseCurrentSpeedToDirectionCalculation
  406. }
  407. }
  408. if Temp &gt;= 2
  409. {
  410. if Temp &lt; 3
  411. {
  412. MouseCurrentSpeedToDirection = -1
  413. Temp -= 2
  414. MouseCurrentSpeedToDirection += %Temp%
  415. Goto EndMouseCurrentSpeedToDirectionCalculation
  416. }
  417. }
  418. if Temp &gt;= 3
  419. {
  420. if Temp &lt; 4
  421. {
  422. MouseCurrentSpeedToDirection = 0
  423. Temp -= 3
  424. MouseCurrentSpeedToDirection += %Temp%
  425. Goto EndMouseCurrentSpeedToDirectionCalculation
  426. }
  427. }
  428. }
  429. EndMouseCurrentSpeedToDirectionCalculation:
  430. <em>;MouseRotationAngle convertion to speed of 90 degrees to right</em>
  431. {
  432. MouseCurrentSpeedToSide = %MouseRotationAngle%
  433. MouseCurrentSpeedToSide /= 90.0
  434. Temp = %MouseCurrentSpeedToSide%
  435. Transform, Temp, mod, %Temp%, 4
  436. if Temp &gt;= 0
  437. {
  438. if Temp &lt; 1
  439. {
  440. MouseCurrentSpeedToSide = 0
  441. MouseCurrentSpeedToSide += %Temp%
  442. Goto EndMouseCurrentSpeedToSideCalculation
  443. }
  444. }
  445. if Temp &gt;= 1
  446. {
  447. if Temp &lt; 2
  448. {
  449. MouseCurrentSpeedToSide = 1
  450. Temp -= 1
  451. MouseCurrentSpeedToSide -= %Temp%
  452. Goto EndMouseCurrentSpeedToSideCalculation
  453. }
  454. }
  455. if Temp &gt;= 2
  456. {
  457. if Temp &lt; 3
  458. {
  459. MouseCurrentSpeedToSide = 0
  460. Temp -= 2
  461. MouseCurrentSpeedToSide -= %Temp%
  462. Goto EndMouseCurrentSpeedToSideCalculation
  463. }
  464. }
  465. if Temp &gt;= 3
  466. {
  467. if Temp &lt; 4
  468. {
  469. MouseCurrentSpeedToSide = -1
  470. Temp -= 3
  471. MouseCurrentSpeedToSide += %Temp%
  472. Goto EndMouseCurrentSpeedToSideCalculation
  473. }
  474. }
  475. }
  476. EndMouseCurrentSpeedToSideCalculation:
  477. MouseCurrentSpeedToDirection *= %MouseCurrentSpeed%
  478. MouseCurrentSpeedToSide *= %MouseCurrentSpeed%
  479. Temp = %MouseRotationAnglePart%
  480. Transform, Temp, Mod, %Temp%, 2
  481. If Button = NumPadUp
  482. {
  483. if Temp = 1
  484. {
  485. MouseCurrentSpeedToSide *= 2
  486. MouseCurrentSpeedToDirection *= 2
  487. }
  488. MouseCurrentSpeedToDirection *= -1
  489. MouseMove, %MouseCurrentSpeedToSide%, %MouseCurrentSpeedToDirection%, 0, R
  490. }
  491. else if Button = NumPadDown
  492. {
  493. if Temp = 1
  494. {
  495. MouseCurrentSpeedToSide *= 2
  496. MouseCurrentSpeedToDirection *= 2
  497. }
  498. MouseCurrentSpeedToSide *= -1
  499. MouseMove, %MouseCurrentSpeedToSide%, %MouseCurrentSpeedToDirection%, 0, R
  500. }
  501. else if Button = NumPadLeft
  502. {
  503. if Temp = 1
  504. {
  505. MouseCurrentSpeedToSide *= 2
  506. MouseCurrentSpeedToDirection *= 2
  507. }
  508. MouseCurrentSpeedToSide *= -1
  509. MouseCurrentSpeedToDirection *= -1
  510. MouseMove, %MouseCurrentSpeedToDirection%, %MouseCurrentSpeedToSide%, 0, R
  511. }
  512. else if Button = NumPadRight
  513. {
  514. if Temp = 1
  515. {
  516. MouseCurrentSpeedToSide *= 2
  517. MouseCurrentSpeedToDirection *= 2
  518. }
  519. MouseMove, %MouseCurrentSpeedToDirection%, %MouseCurrentSpeedToSide%, 0, R
  520. }
  521. else if Button = NumPadHome
  522. {
  523. Temp = %MouseCurrentSpeedToDirection%
  524. Temp -= %MouseCurrentSpeedToSide%
  525. Temp *= -1
  526. Temp2 = %MouseCurrentSpeedToDirection%
  527. Temp2 += %MouseCurrentSpeedToSide%
  528. Temp2 *= -1
  529. MouseMove, %Temp%, %Temp2%, 0, R
  530. }
  531. else if Button = NumPadPgUp
  532. {
  533. Temp = %MouseCurrentSpeedToDirection%
  534. Temp += %MouseCurrentSpeedToSide%
  535. Temp2 = %MouseCurrentSpeedToDirection%
  536. Temp2 -= %MouseCurrentSpeedToSide%
  537. Temp2 *= -1
  538. MouseMove, %Temp%, %Temp2%, 0, R
  539. }
  540. else if Button = NumPadEnd
  541. {
  542. Temp = %MouseCurrentSpeedToDirection%
  543. Temp += %MouseCurrentSpeedToSide%
  544. Temp *= -1
  545. Temp2 = %MouseCurrentSpeedToDirection%
  546. Temp2 -= %MouseCurrentSpeedToSide%
  547. MouseMove, %Temp%, %Temp2%, 0, R
  548. }
  549. else if Button = NumPadPgDn
  550. {
  551. Temp = %MouseCurrentSpeedToDirection%
  552. Temp -= %MouseCurrentSpeedToSide%
  553. Temp2 *= -1
  554. Temp2 = %MouseCurrentSpeedToDirection%
  555. Temp2 += %MouseCurrentSpeedToSide%
  556. MouseMove, %Temp%, %Temp2%, 0, R
  557. }
  558. SetTimer, ButtonAccelerationEnd, 10
  559. return
  560. ButtonAccelerationEnd:
  561. GetKeyState, kstate, %Button%, P
  562. if kstate = D
  563. Goto ButtonAccelerationStart
  564. SetTimer, ButtonAccelerationEnd, off
  565. MouseCurrentAccelerationSpeed = 0
  566. MouseCurrentSpeed = %MouseSpeed%
  567. Button = 0
  568. return
  569. <em>;Mouse wheel movement support</em>
  570. ButtonWheelSpeedUp:
  571. MouseWheelSpeed++
  572. RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
  573. If MouseWheelSpeedMultiplier &lt;= 0
  574. MouseWheelSpeedMultiplier = 1
  575. MouseWheelSpeedReal = %MouseWheelSpeed%
  576. MouseWheelSpeedReal *= %MouseWheelSpeedMultiplier%
  577. ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% lines
  578. SetTimer, RemoveToolTip, 1000
  579. return
  580. ButtonWheelSpeedDown:
  581. RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
  582. If MouseWheelSpeedMultiplier &lt;= 0
  583. MouseWheelSpeedMultiplier = 1
  584. If MouseWheelSpeedReal &gt; %MouseWheelSpeedMultiplier%
  585. {
  586. MouseWheelSpeed--
  587. MouseWheelSpeedReal = %MouseWheelSpeed%
  588. MouseWheelSpeedReal *= %MouseWheelSpeedMultiplier%
  589. }
  590. If MouseWheelSpeedReal = 1
  591. ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% line
  592. else
  593. ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% lines
  594. SetTimer, RemoveToolTip, 1000
  595. return
  596. ButtonWheelAccelerationSpeedUp:
  597. MouseWheelAccelerationSpeed++
  598. RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
  599. If MouseWheelSpeedMultiplier &lt;= 0
  600. MouseWheelSpeedMultiplier = 1
  601. MouseWheelAccelerationSpeedReal = %MouseWheelAccelerationSpeed%
  602. MouseWheelAccelerationSpeedReal *= %MouseWheelSpeedMultiplier%
  603. ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% lines
  604. SetTimer, RemoveToolTip, 1000
  605. return
  606. ButtonWheelAccelerationSpeedDown:
  607. RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
  608. If MouseWheelSpeedMultiplier &lt;= 0
  609. MouseWheelSpeedMultiplier = 1
  610. If MouseWheelAccelerationSpeed &gt; 1
  611. {
  612. MouseWheelAccelerationSpeed--
  613. MouseWheelAccelerationSpeedReal = %MouseWheelAccelerationSpeed%
  614. MouseWheelAccelerationSpeedReal *= %MouseWheelSpeedMultiplier%
  615. }
  616. If MouseWheelAccelerationSpeedReal = 1
  617. ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% line
  618. else
  619. ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% lines
  620. SetTimer, RemoveToolTip, 1000
  621. return
  622. ButtonWheelMaxSpeedUp:
  623. MouseWheelMaxSpeed++
  624. RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
  625. If MouseWheelSpeedMultiplier &lt;= 0
  626. MouseWheelSpeedMultiplier = 1
  627. MouseWheelMaxSpeedReal = %MouseWheelMaxSpeed%
  628. MouseWheelMaxSpeedReal *= %MouseWheelSpeedMultiplier%
  629. ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% lines
  630. SetTimer, RemoveToolTip, 1000
  631. return
  632. ButtonWheelMaxSpeedDown:
  633. RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
  634. If MouseWheelSpeedMultiplier &lt;= 0
  635. MouseWheelSpeedMultiplier = 1
  636. If MouseWheelMaxSpeed &gt; 1
  637. {
  638. MouseWheelMaxSpeed--
  639. MouseWheelMaxSpeedReal = %MouseWheelMaxSpeed%
  640. MouseWheelMaxSpeedReal *= %MouseWheelSpeedMultiplier%
  641. }
  642. If MouseWheelMaxSpeedReal = 1
  643. ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% line
  644. else
  645. ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% lines
  646. SetTimer, RemoveToolTip, 1000
  647. return
  648. ButtonWheelUp:
  649. ButtonWheelDown:
  650. If Button &lt;&gt; 0
  651. {
  652. If Button &lt;&gt; %A_ThisHotkey%
  653. {
  654. MouseWheelCurrentAccelerationSpeed = 0
  655. MouseWheelCurrentSpeed = %MouseWheelSpeed%
  656. }
  657. }
  658. StringReplace, Button, A_ThisHotkey, *
  659. ButtonWheelAccelerationStart:
  660. If MouseWheelAccelerationSpeed &gt;= 1
  661. {
  662. If MouseWheelMaxSpeed &gt; %MouseWheelCurrentSpeed%
  663. {
  664. Temp = 0.001
  665. Temp *= %MouseWheelAccelerationSpeed%
  666. MouseWheelCurrentAccelerationSpeed += %Temp%
  667. MouseWheelCurrentSpeed += %MouseWheelCurrentAccelerationSpeed%
  668. }
  669. }
  670. If Button = NumPadSub
  671. MouseClick, wheelup,,, %MouseWheelCurrentSpeed%, 0, D
  672. else if Button = NumPadAdd
  673. MouseClick, wheeldown,,, %MouseWheelCurrentSpeed%, 0, D
  674. SetTimer, ButtonWheelAccelerationEnd, 100
  675. return
  676. ButtonWheelAccelerationEnd:
  677. GetKeyState, kstate, %Button%, P
  678. if kstate = D
  679. Goto ButtonWheelAccelerationStart
  680. MouseWheelCurrentAccelerationSpeed = 0
  681. MouseWheelCurrentSpeed = %MouseWheelSpeed%
  682. Button = 0
  683. return
  684. RemoveToolTip:
  685. SetTimer, RemoveToolTip, Off
  686. ToolTip
  687. return
  688. </pre>
  689. </body>
  690. </html>