Akrosinos

Clikey Clicks Script v1.1.ahk

Sep 30th, 2013
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ; AutoHotkey Version: 1.x
  3. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  4. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  5. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  6. ;SetMouseDelay, 2
  7. #SingleInstance Force
  8. #Persistent
  9. #UseHook
  10. #InstallKeybdHook
  11.  
  12.  
  13. ; ##################################################
  14. ;
  15. ; Written by REZEL (aka Treplos / Atavus)
  16. ; My SKYRIM Clikey Script -- with user input!!
  17. ;
  18. ; For faster, automatic bulk/mass activities like:
  19. ; Forging / Smelting / Wood Cutting / Mining, etc.
  20. ; or anything that needs repeated clicks in-game.
  21. ;
  22. ; ##################################################
  23.  
  24.  
  25. ; ----------------------------------------
  26. ; Create GUI
  27. ; ----------------------------------------
  28.  
  29. ; Create Hotkey lines
  30. GUI, Font, c0000CC s10 w500, Verdana        ; verdana, blue, size 10, bold 500
  31. GUI, Add, Text,, HOTKEY to start/stop script? (default END)
  32. GUI, Font, cBlack s9, Verdana           ; verdana, black, size 9
  33. GUI, Add, Hotkey, w200 vHOTKEY1, END
  34. GUI, Font, cBlack s1, Verdana
  35. GUI, Add, Text
  36.  
  37. ; Create Loop lines
  38. GUI, Font, c0000CC s10 w500, Verdana
  39. GUI, Add, Text,, Number of script LOOPs? (default 500)
  40. GUI, Font, cBlack s9, Verdana
  41. GUI, Add, Edit, Number Limit4 r1 w60 vLOOPTIMES, 500
  42. GUI, Font, cBlack s1, Verdana
  43. GUI, Add, Text
  44.  
  45. ; Create 1st Key lines
  46. GUI, Font, c0000CC s10 w500, Verdana
  47. GUI, Add, Text,, 1ST KEY to spam? (default E)
  48. GUI, Font, cBlack s9, Verdana
  49. GUI, Add, Edit, Limit2 r1 w40 vKEY1, E
  50. GUI, Font, cBlack s1, Verdana
  51. GUI, Add, Text
  52.  
  53. ; Create 2nd Key lines
  54. GUI, Font, c0000CC s10 w500, Verdana
  55. GUI, Add, Text,, 2ND KEY to spam? (default Y)
  56. GUI, Font, cBlack s9, Verdana
  57. GUI, Add, Edit, Limit2 r1 w40 vKEY2, Y
  58. GUI, Font, cBlack s1, Verdana
  59. GUI, Add, Text
  60.  
  61. ; Create Pause lines
  62. GUI, Font, c0000CC s10 w500, Verdana
  63. GUI, Add, Text,, PAUSE duration, in ms, after each key press? (default 20)
  64. GUI, Font, cBlack s9, Verdana
  65. GUI, Add, Edit, Number Limit4 r1 w50 vPAUSE1, 20
  66.  
  67. ; Create Save button
  68. GUI, Add, Button, vMyOkButton w100 gButtonOK Default, Save
  69. GUI +resize
  70.  
  71. ; Show GUI and title
  72. GUI, Show, AutoSize Center, My Clikey Script  :D  (By Rezel / Treplos)
  73. return
  74.  
  75. ; ----------------------------------------
  76. ; Move Save button to middle
  77. ; ----------------------------------------
  78.  
  79. GUISize:
  80. WinGetPos,,, Width, Height, My Clikey Script  :D  (By Rezel / Treplos)
  81. Width := Width/2, XPos := Width/2
  82. GuiControl, Move, MyOkButton, x%XPos% w%Width%
  83. return
  84.  
  85.  
  86. ; ----------------------------------------
  87. ; Terminate script on exit action
  88. ; ----------------------------------------
  89.  
  90. GuiEscape:      ; if you press Escape on the GUI,
  91. GuiClose:       ; if you press X to close the GUI,
  92. ButtonCancel:       ; if you Close the Button,
  93. FileExit:       ; if you Exit the file,
  94. ExitApp         ; then script will terminate.
  95.  
  96.  
  97. ; ----------------------------------------
  98. ; Store user input into variables if OK
  99. ; ----------------------------------------
  100.  
  101. ButtonOK:
  102. GUI, Submit
  103.  
  104.  
  105. ; ----------------------------------------
  106. ; Display success box
  107. ; ----------------------------------------
  108.  
  109. MsgBox, 0, Woot !!,
  110. ( LTrim
  111. Your input is saved.
  112. You can now start the script.
  113.  
  114. \o/  Hi 5  \o/
  115. )
  116.  
  117.  
  118. ; ----------------------------------------
  119. ; Assign HOTKEY
  120. ; ----------------------------------------
  121.  
  122. Hotkey, %HOTKEY1%, MyHotKey, Toggle
  123. Return
  124.  
  125.  
  126. ; ----------------------------------------
  127. ; Check if Skyrim is on and activate it
  128. ; ----------------------------------------
  129.  
  130. ;If WinExist("ahk_class Skyrim")        ; if game is found,
  131. ;{                      ; <-- Open bracket for Game Check
  132. ;   WinActivate             ; then, activate game window.
  133.  
  134.  
  135. ; ----------------------------------------
  136. ; Start of script and loop
  137. ; ----------------------------------------
  138.  
  139. MyHotKey:               ; press HOTKEY to start script.
  140.  
  141.    Suspend on               ; <-- disable non-protected hotkeys.
  142.                     ; the suspend on command insures that the key won't
  143.                     ; retrigger again as a hotkey because it's going inside
  144.                     ; to be used  the loop to break out.
  145.    Keywait, End             ; <-- wait for the key to be released.
  146.  
  147. ; DEBUGG:               ; uncomment KeyHistory to track key presses.
  148. ; KeyHistory                ; display the history info in a window.
  149.  
  150. Sleep 250               ; DO NOT CHANGE     ; pause for ### ms.
  151.  
  152.     Loop, %LOOPTIMES%                   ; loop for ### time(s).
  153.     {                           ; >> start loop
  154.     GetKeyState, State, %HOTKEY1%, P            ; check HOTKEY state,
  155.         If State = D                    ; if HOTKEY is presssed down,
  156.         Break                       ; stop script, else
  157. ;   Sleep %PAUSE1%                      ; pause for ### ms.
  158.     Send %KEY1%                     ; click KEY1.
  159.     Sleep %PAUSE1%                      ; pause for ### ms.
  160.     Send %KEY2%                     ; click KEY2.
  161.     }                           ; << end loop
  162.  
  163.     Suspend Off         ; <-- re-enable all the suspended hotkeys.
  164.     Return              ; <-- and exit the routine.
  165.  
  166. ; ----------------------------------------
  167. ; End of script and loop
  168. ; ----------------------------------------
  169.  
  170. ;}                              ; --> Close bracket for Game Check.
  171. ;else MsgBox, Error: Skyrim not found!              ; if game not found, then show error.
  172.  
  173. ExitApp                             ; terminate script.
Advertisement
Add Comment
Please, Sign In to add comment