needed it to start as soon as I pressed the key but that key is a variation that comes from the gui hotkey
Code: Select all
#NoEnv
#SingleInstance Force
#MaxThreadsPerHotkey, 99999999
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
SendMode Input
SetBatchLines -1
on := false
home := "hotkeyon"
;-----------------------------------------------------------------------------------
Gui, Add, GroupBox, x1 y1 w179 h325, ;GroupBox 1
Gui, Add, Text, x10 y10 w70 h20 , HOTKEY
Gui, Add, Hotkey, x120 y15 w50 h20 vhome, iniciar
Gui, Add, Hotkey, x10 y30 w25 h17 vHK, 1 ;====================================================
Gui, Add, Edit, x10 y50 w35 h17 vTemp1, 2000
;Gui, Add, Text, x110 y10 w50 h20 , TEMPO
;---------------------------------------------------------------on-off--------------
Gui, Add, Button, x60 y60 w40 h20 gonnn, ON ;====
Gui, Add, Button, x60 y90 w40 h20 gpause, OFF
; Generated using SmartGUI Creator for SciTE
Gui, Show, w180 h330, teste
return
%home% := hotkeyon
home:: ; <<<<<<<<<<<<<<<<<<<<==========================================================================
on := !On
While on {
onnn:
Loop
ifWinExist, ahk_exe ########################
Gui, Submit, NoHide
if (ErrorLevel = 0)
{
{
sleep,200
Send, {%hk%}
Sleep, %Temp1%
goto, atacar
}
if (errorLevel = 0)
{
goto, atacar
}
}
if (ErrorLevel = 1)
{
return
}
}
return
pause:
Pause
return
GuiClose:
ExitApp
return