Opt("GUIOnEventMode", 1)
#include "MetroGUI-UDF\MetroGUI_UDF.au3"
#include "MetroGUI-UDF\_GUIDisable.au3"
#include <GUIConstants.au3>
Global $Auto = 0, $a, $color = 0xFF0000, $scan = 0
$Form1 = _Metro_CreateGUI("", 500, 230, -1, -1)
$Control_Buttons = _Metro_AddControlButtons()
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
$Button1 = _Metro_CreateButtonEx2("Выход", 340, 115, 100, 30)
$Toggle1 = _Metro_CreateOnOffToggle("Вкл", "Выкл", 8, 5, 130, 30)
$Toggle2 = _Metro_CreateOnOffToggle("Вкл", "Выкл", 8, 40, 130, 30)
$Toggle3 = _Metro_CreateOnOffToggle("Вкл", "Выкл", 8, 75, 130, 30)
$Toggle4 = _Metro_CreateOnOffToggle("Вкл", "Выкл", 8, 110, 130, 30)
$Toggle5 = _Metro_CreateOnOffToggle("Вкл", "Выкл", 8, 145, 130, 30)
$Toggle6 = _Metro_CreateOnOffToggle("Вкл", "Выкл", 8, 180, 130, 30)
HotKeySet('{HOME}','_ShowGUI')
GUISetState(@SW_SHOW)
GUICtrlSetOnEvent($GUI_CLOSE_BUTTON, "_GUIEvent_ControlButtons")
GUICtrlSetOnEvent($Button1, "_GUIEvent_Buttons")
GUICtrlSetOnEvent($Toggle1, "_GUIEvent_Toggles")
GUICtrlSetOnEvent($Toggle2, "_GUIEvent_Toggles")
GUICtrlSetOnEvent($Toggle3, "_GUIEvent_Toggles")
GUICtrlSetOnEvent($Toggle4, "_GUIEvent_Toggles")
GUICtrlSetOnEvent($Toggle5, "_GUIEvent_Toggles")
GUICtrlSetOnEvent($Toggle6, "_GUIEvent_Toggles")
While 1
Sleep(5)
WEnd
Func _GUIEvent_Toggles()
Switch @GUI_CtrlId
Case $Toggle1
If _Metro_ToggleIsChecked($Toggle1) Then
_Metro_ToggleUnCheck($Toggle1)
ConsoleWrite("" & @CRLF)
startauto()
Else
_Metro_ToggleCheck($Toggle1)
ConsoleWrite("" & @CRLF)
offauto()
EndIf
Case $Toggle2
If _Metro_ToggleIsChecked($Toggle2) Then
_Metro_ToggleUnCheck($Toggle2)
ConsoleWrite("" & @CRLF)
Else
_Metro_ToggleCheck($Toggle2)
ConsoleWrite("" & @CRLF)
EndIf
Case $Toggle3
If _Metro_ToggleIsChecked($Toggle3) Then
_Metro_ToggleUnCheck($Toggle3)
ConsoleWrite("" & @CRLF)
Else
_Metro_ToggleCheck($Toggle3)
ConsoleWrite("" & @CRLF)
EndIf
Case $Toggle4
If _Metro_ToggleIsChecked($Toggle4) Then
_Metro_ToggleUnCheck($Toggle4)
ConsoleWrite("" & @CRLF)
Else
_Metro_ToggleCheck($Toggle4)
ConsoleWrite("" & @CRLF)
EndIf
Case $Toggle5
If _Metro_ToggleIsChecked($Toggle5) Then
_Metro_ToggleUnCheck($Toggle5)
ConsoleWrite("" & @CRLF)
Else
_Metro_ToggleCheck($Toggle5)
ConsoleWrite("" & @CRLF)
EndIf
Case $Toggle6
If _Metro_ToggleIsChecked($Toggle6) Then
_Metro_ToggleUnCheck($Toggle6)
ConsoleWrite("" & @CRLF)
Else
_Metro_ToggleCheck($Toggle6)
ConsoleWrite("" & @CRLF)
EndIf
EndSwitch
EndFunc
Func _GUIEvent_ControlButtons()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
_Metro_GUIDelete($Form1)
Exit
EndSwitch
EndFunc
Func _GUIEvent_Buttons()
Switch @GUI_CtrlId
Case $Button1
_GUIDisable($Form1, 0, 30)
_Metro_MsgBox(0, "", "", 400, 11, $Form1)
_GUIDisable($Form1)
Exit
EndSwitch
EndFunc
Func _ShowGUI()
Switch BitAND(WinGetState($Form1), 2)
Case 2
GUISetState(@SW_HIDE, $Form1)
case 0
GUISetState(@SW_SHOW, $Form1)
EndSwitch
EndFunc
Func startauto()
$auto = 1
EndFunc
Func offauto()
$auto = 0
EndFunc