Advertisement
berban1

Untitled

Dec 19th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn ; Enable warnings to assist with detecting common errors.
  3. SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  5.  
  6. random, rand1, 180, 312
  7. random, rand2, 182, 320
  8. random, rand3, 280, 350
  9. random, rand4, 150, 222
  10. random, rand5, 223, 250
  11.  
  12. Item1 = Hotkey Set 1
  13. Item2 = Hotkey Set 2
  14. Item3 = Hotkey Set 3
  15. AllOff = All hotkeys off
  16.  
  17. Loop 3
  18. Menu, MyMenu, Add, % Item%A_Index%, HotkeySet%A_Index% ; keep this code in the "auto-execute" section
  19. Menu, MyMenu, Add ; adds a separator
  20. Menu, MyMenu, Add, %AllOff%, AllOff
  21. Return
  22.  
  23. Numpad0::ExitApp
  24.  
  25. Numpad1::Menu, MyMenu, Show
  26.  
  27. AllOff:
  28. HotkeySet1:
  29. HotkeySet2:
  30. HotkeySet3:
  31. Loop 3
  32. Menu, MyMenu, Uncheck, % Item%A_Index% ; unchecks all your menus
  33. HotkeySet := SubStr(A_ThisLabel, 10) ; sets it to the 10th character of the label: 1, 2, 3, or blank for "AllOff"
  34. If HotkeySet
  35. Menu, MyMenu, Check, % Item%HotkeySet% ; Checks the active one
  36. Return
  37.  
  38.  
  39.  
  40.  
  41. 6::
  42. {
  43. loop
  44. {
  45.  
  46. GetKeyState, state, 6, P
  47. if state = U ; The key has been released, so break out of the loop.
  48. break
  49.  
  50.  
  51.  
  52. list := "rand1;rand2;rand3;rand4;rand5"
  53. listsize = 5
  54. Random, rand, 1, %listsize%
  55. randr = % listGet(list, rand, ";")
  56.  
  57. If HotkeySet = 1
  58. Send j
  59. Else If HotkeySet = 2
  60. Send a
  61. Else
  62. Send q
  63.  
  64. sleep (%randr%)
  65.  
  66. ; return item at said position in said list
  67. listGet(list,pos=1,del=",") {
  68. StringSplit, item, list, %del%
  69. return item%pos%
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement