PageRenderTime 42ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/ahk_scripts/tools/lib/faskNavKeys.ahk

http://github.com/jixiuf/my_autohotkey_scripts
AutoHotKey | 237 lines | 192 code | 42 blank | 3 comment | 0 complexity | 5bd2a44d804fe445376462144c38cf8e MD5 | raw file
Possible License(s): GPL-3.0
  1. ;FastNavKeys.ahk
  2. ; Speeds up navigation keys (or any other keys)
  3. ;Skrommel @2007
  4. #SingleInstance,Force
  5. #NoEnv
  6. SetBatchLines,-1
  7. SetKeyDelay,-1
  8. SendMode,Event
  9. applicationname=FastNavKeys
  10. Gosub,INIREAD
  11. Gosub,TRAYMENU
  12. StringSplit,hotkey_,keys,`,
  13. Loop,% hotkey_0
  14. {
  15. hotkey:=hotkey_%A_Index%
  16. Hotkey,$~%hotkey%,DOWN,On B0
  17. Hotkey,$~+%hotkey%,DOWN,On B0
  18. Hotkey,$~^%hotkey%,DOWN,On B0
  19. Hotkey,$~!%hotkey%,DOWN,On B0
  20. Hotkey,*~%hotkey% Up,UP,On B0
  21. }
  22. down=0
  23. Return
  24. DOWN:
  25. StringTrimLeft,hotkey,A_ThisHotkey,2
  26. StringLeft,modifier,hotkey,1
  27. If modifier In +,^,!
  28. StringTrimLeft,hotkey,hotkey,1
  29. Else
  30. modifier=
  31. If down=0
  32. {
  33. down=1
  34. counter=0
  35. Gosub,SEND
  36. }
  37. Return
  38. UP:
  39. down=0
  40. SEND:
  41. Loop
  42. {
  43. counter+=1
  44. If counter=1
  45. Sleep,% delay1
  46. Else
  47. If delay2=0
  48. Sleep,-1
  49. Else
  50. Sleep,% delay2/(A_Index*factor+1)
  51. If down=0
  52. Break
  53. Send,%modifier%{%hotkey%}
  54. }
  55. Return
  56. TRAYMENU:
  57. Menu,Tray,NoStandard
  58. Menu,Tray,DeleteAll
  59. Menu,Tray,Add,%applicationname%,ABOUT
  60. Menu,Tray,Add,
  61. Menu,Tray,Default,%applicationname%
  62. Menu,Tray,Add,&Settings...,SETTINGS
  63. Menu,Tray,Add,&About...,About
  64. Menu,Tray,Add,E&xit,EXIT
  65. Menu,Tray,Tip,%applicationname%
  66. Return
  67. SETTINGS:
  68. Gui,Destroy
  69. Gui,Margin,20
  70. Gui,Add,GroupBox,xm-10 y+10 w420 h120,&Speed
  71. Gui,Add,Edit,xm yp+20 w100 vvdelay1
  72. Gui,Add,UpDown, Range0-999,%delay1%
  73. Gui,Add,Text,x+10 yp+5,Delay before autorepeating (ms)
  74. Gui,Add,Edit,xm y+10 w100 vvdelay2
  75. Gui,Add,UpDown,Range0-999,%delay2%
  76. Gui,Add,Text,x+10 yp+5,Delay between repetitions (ms)
  77. Gui,Add,Edit,xm y+10 w100 vvfactor,%factor%
  78. Gui,Add,Text,x+10 yp+5,How fast to increase repetiton speed
  79. Gui,Add,Text,xp y+5,(Range: 0.0-999.9 0.0=No increase)
  80. Gui,Add,GroupBox,xm-10 y+20 w420 h130,&Keys
  81. Gui,Add,Edit,xm yp+20 w400 h80 vvkeys,%keys%
  82. Gui,Add,Text,xm y+10,Default: PgUp,PgDn,Left,Right,Up,Down
  83. Gui,Add,Button,xm y+30 w75 gSETTINGSOK Default,&OK
  84. Gui,Add,Button,x+5 yp w75 gSETTINGSCANCEL,&Cancel
  85. Gui,Show,w440,%applicationname% Settings
  86. Return
  87. SETTINGSOK:
  88. Gui,Submit
  89. If vkeys<>
  90. keys:=vkeys
  91. delay1:=vdelay1
  92. delay2:=vdelay2
  93. factor:=vfactor
  94. Gosub,INIWRITE
  95. Gosub,SETTINGSCANCEL
  96. Return
  97. SETTINGSCANCEL:
  98. Gui,Destroy
  99. Return
  100. GuiClose:
  101. Gosub,SETTINGSCANCEL
  102. Return
  103. EXIT:
  104. ExitApp
  105. INIREAD:
  106. IfNotExist,%applicationname%.ini
  107. {
  108. delay1=90
  109. delay2=0
  110. factor=0.0
  111. keys=Left,Right,Up,Down
  112. Gosub,INIWRITE
  113. Gosub,ABOUT
  114. }
  115. IniRead,delay1,%applicationname%.ini,Settings,delay1
  116. IniRead,delay2,%applicationname%.ini,Settings,delay2
  117. IniRead,factor,%applicationname%.ini,Settings,factor
  118. IniRead,keys,%applicationname%.ini,Settings,keys
  119. If (delay1="Error" or delay1="")
  120. delay1=90
  121. If (delay2="Error" or delay2="")
  122. delay2=0
  123. If (factor="Error" or factor="")
  124. factor=0.0
  125. If (keys="Error" or keys="")
  126. keys=Left,Right,Up,Down
  127. Gosub,INIWRITE
  128. Return
  129. INIWRITE:
  130. IniWrite,%delay1%,%applicationname%.ini,Settings,delay1
  131. IniWrite,%delay2%,%applicationname%.ini,Settings,delay2
  132. IniWrite,%factor%,%applicationname%.ini,Settings,factor
  133. IniWrite,%keys%,%applicationname%.ini,Settings,keys
  134. Return
  135. ABOUT:
  136. Gui,99:Destroy
  137. Gui,99:Margin,20,20
  138. Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
  139. Gui,99:Font,Bold
  140. Gui,99:Add,Text,x+10 yp+10,%applicationname% v1.0
  141. Gui,99:Font
  142. Gui,99:Add,Text,y+10,Speed up the navigation keys (or any other keys).
  143. Gui,99:Add,Text,y+10,- To change the settings, choose Settings in the tray menu.
  144. Gui,99:Add,Text,y+10,- Warning! It will make all other computers seem slow!
  145. Gui,99:Add,Picture,xm y+20 Icon5,%applicationname%.exe
  146. Gui,99:Font,Bold
  147. Gui,99:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
  148. Gui,99:Font
  149. Gui,99:Add,Text,y+10,For more tools, information and donations, please visit
  150. Gui,99:Font,CBlue Underline
  151. Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
  152. Gui,99:Font
  153. Gui,99:Add,Picture,xm y+20 Icon7,%applicationname%.exe
  154. Gui,99:Font,Bold
  155. Gui,99:Add,Text,x+10 yp+10,DonationCoder
  156. Gui,99:Font
  157. Gui,99:Add,Text,y+10,Please support the contributors at
  158. Gui,99:Font,CBlue Underline
  159. Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
  160. Gui,99:Font
  161. Gui,99:Add,Picture,xm y+20 Icon6,%applicationname%.exe
  162. Gui,99:Font,Bold
  163. Gui,99:Add,Text,x+10 yp+10,AutoHotkey
  164. Gui,99:Font
  165. Gui,99:Add,Text,y+10,This tool was made using the powerful
  166. Gui,99:Font,CBlue Underline
  167. Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
  168. Gui,99:Font
  169. Gui,99:Show,,%applicationname% About
  170. hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
  171. OnMessage(0x200,"WM_MOUSEMOVE")
  172. Return
  173. 1HOURSOFTWARE:
  174. Run,http://www.1hoursoftware.com,,UseErrorLevel
  175. Return
  176. DONATIONCODER:
  177. Run,http://www.donationcoder.com,,UseErrorLevel
  178. Return
  179. AUTOHOTKEY:
  180. Run,http://www.autohotkey.com,,UseErrorLevel
  181. Return
  182. 99GuiClose:
  183. Gui,99:Destroy
  184. OnMessage(0x200,"")
  185. DllCall("DestroyCursor","Uint",hCur)
  186. Return
  187. WM_MOUSEMOVE(wParam,lParam)
  188. {
  189. Global hCurs
  190. MouseGetPos,,,,ctrl
  191. If ctrl in Static9,Static13,Static17
  192. DllCall("SetCursor","UInt",hCurs)
  193. Return
  194. }
  195. Return