Что нового

Элементы GUI функции и элементы GUI

Пост номер 2 был отмечен как лучший ответ.

Alex58reg

Новичок
Сообщения
24
Репутация
0
нужна помощь вот код
Код:
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

мне нужно прилепить к нему вот этот код не выходит у меня помогите
Код:
Global $Auto = 0, $a, $color = 0xFF0000, $scan = 0

это
Код:
If $auto = 1 then
PixelSearch(960,535,250,250,$color)
If Not @error = 1 then
$a = 1
While $a < 2
Call('aug')
$a = $a + 1
WEnd
EndIf
EndIf

это
Код:
Func aug()
MouseDown("left")
Sleep(150)
MouseUp("left")
EndFunc

и это
Код:
Func startauto()
$auto = 1
EndFunc
Func offauto()
$auto = 0
EndFunc

пожалуйста помогите соединить с Toggle1
огромное спасибо тому кто поможет
 

ra4o

AutoIT Гуру
Сообщения
1 101
Репутация
222
Код:
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

    If $Auto = 1 Then
        PixelSearch(960, 535, 250, 250, $color)
        If Not @error = 1 Then
            $a = 1
            While $a < 2
                Call('aug')
                $a = $a + 1
            WEnd
        EndIf
    Else
        Sleep(5)
    EndIf

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   ;==>_GUIEvent_Toggles


Func _GUIEvent_ControlButtons()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
            _Metro_GUIDelete($Form1)
            Exit
    EndSwitch
EndFunc   ;==>_GUIEvent_ControlButtons

Func _GUIEvent_Buttons()
    Switch @GUI_CtrlId
        Case $Button1
            _GUIDisable($Form1, 0, 30)
            _Metro_MsgBox(0, "", "", 400, 11, $Form1)
            _GUIDisable($Form1)
            Exit
    EndSwitch
EndFunc   ;==>_GUIEvent_Buttons

Func _ShowGUI()
    Switch BitAND(WinGetState($Form1), 2)
        Case 2
            GUISetState(@SW_HIDE, $Form1)
        Case 0
            GUISetState(@SW_SHOW, $Form1)
    EndSwitch
EndFunc   ;==>_ShowGUI

Func aug()
    MouseDown("left")
    Sleep(150)
    MouseUp("left")
EndFunc   ;==>aug

Func startauto()
    $Auto = 1
EndFunc   ;==>startauto

Func offauto()
    $Auto = 0
EndFunc   ;==>offauto
 
Последнее редактирование:
Верх