Button funzt nicht!

  • hi leute,

    ich hab folgendes prob:

    also wenn ich das prog starte und dann auf den button klickte soll die gui auf hide gesetzt werden.
    nun soll bei einem doppelklick auf das tray icon die gui wieder auf show gesetzt werden.
    das klappt auch alles nur sobald die gui wieder show is funktioniert die gui nicht mehr, sprich es gehen keine button mehr.

    hoffe irh könnt mir helfen.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <misc.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #NoTrayIcon

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet("{F7}","_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    Opt("TrayMenuMode", 1)
    Opt("TrayOnEventMode",1)
    Opt("GUIOnEventMode", 1)
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Shooter", 114, 131, 0, 0, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    $Input1 = GUICtrlCreateInput("1", 56, 8, 41, 21)
    $Updown1 = GUICtrlCreateUpdown($Input1)
    GUICtrlSetLimit(-1, 10, 1)
    $Label1 = GUICtrlCreateLabel("Clicks", 8, 8, 38, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Speed", 8, 40, 40, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Input2 = GUICtrlCreateInput("1", 56, 40, 49, 21)
    $Updown2 = GUICtrlCreateUpdown($Input2)
    GUICtrlSetLimit(-1, 100, 1)
    $Combo1 = GUICtrlCreateCombo("left", 56, 72, 49, 25)
    GUICtrlSetData(-1, "right")
    $Label3 = GUICtrlCreateLabel("Key", 8, 72, 25, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button1 = GUICtrlCreateButton("Save / GO", 8, 104, 97, 17, 0)
    GUICtrlSetOnEvent(-1, "_Save_Go")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    Global $mouse = ""

    [/autoit] [autoit][/autoit] [autoit]

    _Filter()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE,"_MaxWin")
    Sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Save_Go()
    GUISetState(@SW_HIDE)
    Opt("TrayIconHide",0)
    _Go()
    EndFunc ;==>_Save_Go

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Exit
    EndFunc ;==>_Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _ClickNow()
    $pos = MouseGetPos()
    For $i = 1 To GUICtrlRead($Input1)
    MouseClick(GUICtrlRead($Combo1),$pos[0],$pos[1],1,GUICtrlRead($Input2))
    Sleep(100)
    Next
    EndFunc ;==>_ClickNow

    [/autoit] [autoit][/autoit] [autoit]

    Func _MaxWin()
    GUISetState(@SW_SHOW)
    Opt("TrayIconHide",1)
    EndFunc ;==>_MaxWin

    [/autoit] [autoit][/autoit] [autoit]

    Func _Filter()
    $1 = StringSplit("left:right",":")
    $2 = StringSplit("01:02",":")
    For $i = 1 To 2
    If GUICtrlRead($Combo1) = $1[$i] Then $mouse = $2[$i]
    Next
    EndFunc ;==>_Filter

    [/autoit] [autoit][/autoit] [autoit]

    Func _Go()
    While 1
    If _IsPressed("59") and _IsPressed($mouse) Then
    While 1
    If Not _IsPressed($mouse) Then ExitLoop
    Sleep(50)
    WEnd
    _ClickNow()
    EndIf
    Sleep(50)
    WEnd
    EndFunc ;==>_Go

    [/autoit]
  • Hi,
    du steckst noch in der While-Schleife von der Go() Version drin.

    So könnte man die Go-Func ändern

    Spoiler anzeigen
    [autoit]

    Func _Go()
    While 1
    If _IsPressed("59") and _IsPressed($mouse) Then
    While 1
    If Not _IsPressed($mouse) Then ExitLoop
    Sleep(50)
    WEnd
    _ClickNow()
    EndIf
    Sleep(50)
    If WinExists("Shooter") Then ExitLoop
    WEnd
    EndFunc ;==>_Go

    [/autoit]

    Denke es müßte aber noch andere Wege geben :rock:

  • danke^^ du hast das problem gefunden. nur die lösung is nich so ganz gelungen. sie hat zwar das problem gelöst aber ein anderes verursacht, weil jetz funzt die go func nich mehr :(

  • hm, hast recht war nah dran.
    So müßte es aber klappen, oder?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <misc.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #NoTrayIcon

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet("{F7}","_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    Opt("TrayMenuMode", 1)
    Opt("TrayOnEventMode",1)
    Opt("GUIOnEventMode", 1)
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Shooter", 114, 131, 0, 0, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    $Input1 = GUICtrlCreateInput("1", 56, 8, 41, 21)
    $Updown1 = GUICtrlCreateUpdown($Input1)
    GUICtrlSetLimit(-1, 10, 1)
    $Label1 = GUICtrlCreateLabel("Clicks", 8, 8, 38, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Speed", 8, 40, 40, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Input2 = GUICtrlCreateInput("1", 56, 40, 49, 21)
    $Updown2 = GUICtrlCreateUpdown($Input2)
    GUICtrlSetLimit(-1, 100, 1)
    $Combo1 = GUICtrlCreateCombo("left", 56, 72, 49, 25)
    GUICtrlSetData(-1, "right")
    $Label3 = GUICtrlCreateLabel("Key", 8, 72, 25, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button1 = GUICtrlCreateButton("Save / GO", 8, 104, 97, 17, 0)
    GUICtrlSetOnEvent(-1, "_Save_Go")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    Global $mouse = ""

    [/autoit] [autoit][/autoit] [autoit]

    Dim $beenden

    [/autoit] [autoit][/autoit] [autoit]

    _Filter()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE,"_MaxWin")
    Sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Save_Go()
    GUISetState(@SW_HIDE)
    Opt("TrayIconHide",0)
    $beenden = 0
    _Go()
    $beenden = 0
    EndFunc ;==>_Save_Go

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Exit
    EndFunc ;==>_Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _ClickNow()
    $pos = MouseGetPos()
    For $i = 1 To GUICtrlRead($Input1)
    MouseClick(GUICtrlRead($Combo1),$pos[0],$pos[1],1,GUICtrlRead($Input2))
    Sleep(100)
    Next
    EndFunc ;==>_ClickNow

    [/autoit] [autoit][/autoit] [autoit]

    Func _MaxWin()
    $beenden = 1
    GUISetState(@SW_SHOW)
    Opt("TrayIconHide",1)
    EndFunc ;==>_MaxWin

    [/autoit] [autoit][/autoit] [autoit]

    Func _Filter()
    $1 = StringSplit("left:right",":")
    $2 = StringSplit("01:02",":")
    For $i = 1 To 2
    If GUICtrlRead($Combo1) = $1[$i] Then $mouse = $2[$i]
    Next
    EndFunc ;==>_Filter

    [/autoit] [autoit][/autoit] [autoit]

    Func _Go()
    While 1
    If _IsPressed("59") and _IsPressed($mouse) Then
    While 1
    If Not _IsPressed($mouse) Then ExitLoop
    Sleep(50)
    WEnd
    _ClickNow()
    EndIf
    Sleep(50)
    If $beenden = 1 Then ExitLoop
    WEnd
    EndFunc ;==>_Go

    [/autoit]