Hey i have next problem with this script, all work fine only when i want to turn it off i cant i must do that in on tray icon. Anyone know where problem is ?
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
$GUI = GUICreate("AL - macro", 409, 145, 265, 434)
GUISetFont(9, 400, 0, "Tahoma")
$Group1 = GUICtrlCreateGroup("Input keys", 8, 5, 393, 50)
$textInput = GUICtrlCreateInput("", 16, 24, 376, 22)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Cast time", 8, 56, 393, 49)
$Slider1 = GUICtrlCreateSlider(16, 77, 374, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS))
GUICtrlSetLimit(-1, 99, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$startBtn = GUICtrlCreateButton("Start", 8, 112, 75, 25)
GUISetState(@SW_SHOW)
_load()
HotKeySet("^x", "_spam")
Global $run
Global $handle
If Not FileExists("C:\Program Files\config.ini") Then _FileCreate("C:\Program Files\config.ini")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_save()
GUIDelete($GUI)
Exit
Case $startBtn
$handle = WinGetHandle("Archlord")
If ProcessExists("AlefClient.exe") Then
If WinExists($handle) Then WinActivate($handle)
TrayTip("AL - macro running", "Press CTRL + x to start", 10, 1)
GUICtrlSetState($startBtn, $GUI_DISABLE)
Else
TrayTip("AL - macro running", "Game is not running, start game first", 10, 1)
EndIf
EndSwitch
WEnd
Func _spam()
$run = Not $run
While True
If $run Then
$text = GUICtrlRead($textInput)
$time = 1500
$time = $time - ($time / 100 * GUICtrlRead($Slider1))
ControlSend($handle, "", "", $text)
Sleep($time)
EndIf
WEnd
EndFunc
Func _save()
IniWrite("C:\Program Files\config.ini", "Keys", 1, GUICtrlRead($textInput))
IniWrite("C:\Program Files\config.ini", "Slider", 1, GUICtrlRead($Slider1))
EndFunc
Func _load()
Local $keys, $slider
$keys = IniRead("C:\Program Files\config.ini", "Keys", 1, "")
GUICtrlSetData($textInput, $keys)
$slider = IniRead("C:\Program Files\config.ini", "Slider", 1, "")
GUICtrlSetData($Slider1, $slider)
EndFunc