Danke für den Tipp mit dem OnEventMode..
Nur die Radios in eine Zeile zu packen habe ich nicht geschafft..
Habe es jetzt so gelöst:
AutoIt: GUI OnEvent
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
HotKeySet("^e", "Terminate")
HotKeySet("^p", "TogglePause")
global $y = 0, $x = 0
global $jn = 0
Global $idle = 0
Global $sComboRead = 0
Global $sRadioRead1 = 0
Global $sRadioRead2 = 0
Global $sRadioRead3 = 0
Global $sRadioRead4 = 0
Global $sRadioRead5 = 0
Global $event = 0
Global $suche = 0
Global $g_bPaused = False
Global $idAnzahl = 0
Global $Runde = 0
Global $Startcounter = 0
Example()
Func Example()
Opt("GUICoordMode", 1)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)
GUICreate("Parent1")
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
; Buttons
GUICtrlCreateButton("Go", 10, 260, 120, 20)
GUICtrlSetOnEvent(-1, "OKPressed")
GUICtrlCreateButton("Ende", 200, 260, 120, 20)
GUICtrlSetOnEvent(-1, "Terminate")
; Texte
GUICtrlCreateLabel("Text 1", 10, 10)
GUICtrlCreateLabel("Text 2", 10, 40)
GUICtrlCreateLabel("Text 3", 200, 40)
GUICtrlCreateLabel("Text 4", 10, 300)
GUICtrlCreateLabel("Text 5", 10, 170)
GUICtrlCreateLabel("Text 6", 200, 170)
GUICtrlCreateLabel("Zum Beenden STRG + E für Pause STRG + P", 10, 230)
; Radio Buttons
Global $idRadio1 = GUICtrlCreateRadio("Radio 1", 10, 70, 120, 20)
Global $idRadio2 = GUICtrlCreateRadio("Radio 2", 10, 90, 120, 20)
Global $idRadio3 = GUICtrlCreateRadio("Radio 3", 10, 110, 120, 20)
Global $idRadio5 = GUICtrlCreateRadio("Radio 5", 10, 130, 120, 20)
Global $idRadio4 = GUICtrlCreateRadio("Radio 4", 200, 70, 120, 20)
GUICtrlSetState($idRadio1, $GUI_CHECKED)
; Combobox
GUICtrlCreateLabel("Text 5", 10, 170)
Global $idComboBox = GUICtrlCreateCombo("Combo1", 10, 190, 120, 20)
GUICtrlSetData($idComboBox, "Combo2|Combo3|Combo4|Combo5|Combo6")
global $sComboRead = ""
; Zahleneingabe
Global $idRound = GUICtrlCreateInput(0, 200, 190, 40, 20)
GUISetState(@SW_SHOW)
; Script Ausführen
While 1
Sleep(1000)
consoleWrite ( @ScriptLineNumber & " Radio = " & $jn & " Combo = " & $sComboRead & " Anzahl = " & $idAnzahl & " Event = " & $event & @CRLF)
WEnd
EndFunc ;==>Example
Func OKPressed()
$sComboRead = GUICtrlRead($idComboBox)
$sRadioRead1 = GUICtrlRead($idRadio1)
$sRadioRead2 = GUICtrlRead($idRadio2)
$sRadioRead3 = GUICtrlRead($idRadio3)
$sRadioRead4 = GUICtrlRead($idRadio4)
$sRadioRead5 = GUICtrlRead($idRadio5)
$idAnzahl = GUICtrlRead($idRound)
If $sRadioRead1 = 1 Then
global $jn = 1
Global $event = "checkForStart"
EndIf
If $sRadioRead2 = 1 Then
global $jn = 2
Global $event = "checkForStart"
EndIf
If $sRadioRead3 = 1 Then
global $jn = 3
Global $event = "checkForStart"
EndIf
If $sRadioRead4 = 1 Then
global $jn = 4
Global $event = "checkForStart"
EndIf
If $sRadioRead5 = 1 Then
global $jn = 5
Global $event = "checkForStart"
EndIf
consoleWrite ( @ScriptLineNumber & " Radio = " & $jn & " Combo = " & $sComboRead & " Anzahl = " & $idAnzahl & " Event = " & $event & @CRLF)
EndFunc ;==>OKPressed
Func SpecialEvents()
consoleWrite ( @ScriptLineNumber & @CRLF)
Select
Case @GUI_CtrlId = $GUI_EVENT_CLOSE
Exit
Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
Case @GUI_CtrlId = $GUI_EVENT_RESTORE
EndSelect
EndFunc ;==>SpecialEvents
; zum Beenden des Tools
Func Terminate()
Exit
EndFunc
; Pause Funktion
Func TogglePause()
$g_bPaused = Not $g_bPaused
While $g_bPaused
Sleep(100)
ToolTip('Script is "Paused"', 0, 0)
WEnd
ToolTip("")
EndFunc ;==>TogglePause
Alles anzeigen