Advertisement
Toys0125

Auto Hotkey for stating a bat file and inputing a number.

Dec 7th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ^PgDn::
  2. if winc_presses > 0 ; SetTimer already started, so we log the keypress instead.
  3. {
  4.     winc_presses += 1
  5.     return
  6. }
  7. ; Otherwise, this is the first press of a new series. Set count to 1 and start
  8. ; the timer:
  9. winc_presses = 1
  10. SetTimer, KeyWinC, -600 ; Wait for more presses within a 400 millisecond window.
  11. return
  12.  
  13. KeyWinC:
  14. if winc_presses = 1 ; The key was pressed once.
  15. {
  16.     IfWinExist, NemosMiner
  17.     {
  18.     WinClose, NemosMiner
  19.     }
  20.     Run, C:\Users\marcu\Desktop\Tools\MineWhat.bat , , , processVarMine
  21.         Sleep, 250
  22.         WinActivate, ahk_pid %processVarMine%
  23.         Send 3
  24.         Send {Enter}
  25. }
  26. else if winc_presses = 2 ; The key was pressed twice.
  27. {
  28.     IfWinExist, NemosMiner
  29.     {
  30.     WinClose, NemosMiner
  31.     }
  32.     Run, C:\Users\marcu\Desktop\Tools\MineWhat.bat , , , processVarMine
  33.         Sleep, 250
  34.         WinActivate, ahk_pid %processVarMine%
  35.         Send 4
  36.         Send {Enter}
  37. }
  38. else if winc_presses > 2
  39. {
  40. SetTimer, CheckForBatchWindow, 1800000
  41. Return
  42.  
  43. CheckForBatchWindow:
  44. IfLess, A_TimeIdlePhysical, 600000
  45. {
  46.     SetTimer, ,ON
  47.    
  48.     Return
  49. }
  50. ;Else
  51. If DeactiveRestart = false
  52. {
  53.     IfWinExist, NemosMiner
  54.     {
  55.         WinClose, NemosMiner
  56.     }
  57.         Run, C:\Users\marcu\Desktop\Tools\MineWhat.bat , , , processVarMine
  58.         Sleep, 250
  59.         WinActivate, ahk_pid %processVarMine%
  60.         Send 4
  61.         Send {Enter}
  62.         SetTimer, ,ON
  63.         Return
  64.     }
  65. }
  66. Else {
  67.     MsgBox, Restart is Deactived.
  68. }
  69. ; Regardless of which action above was triggered, reset the count to
  70. ; prepare for the next series of presses:
  71. winc_presses = 0
  72. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement