2 GUI´s gleichzeitig

10/04/2010 20:36 checker0899#1
Heyy,
Also zum Prob.. Ich will das ich 2 GUI´s gleichzeitig laufen lassen kann.. das bekomm ich noch hin ABER wenn ich eine GUI beende beenden sich beide ich will aber das das welches ich nicht beende (wow das gibt sogar Sinn :D) offen bleibt... Wie kann ich verhindern das beide sich schließen?
Hier mal der Code:
PHP Code:
HotKeySet ("{PGUP}""_Start")
HotKeySet ("{PGDN}""_Exit")   ;==> HotKeySet

#include <GUIConstants.au3>   ;==> Include

#Region ### START Koda GUI section ### Form=C:\Users\philipp\Desktop\Hack\Alle meine Scripte\KODA\Formen\Anti-Afk_Tool.kxf
$Form1 GUICreate("Anti-Afk_Tool"213192202140)
$Label1 GUICtrlCreateLabel("Start ==>  Bild Oben"161289917)
$Label2 GUICtrlCreateLabel("Exit ==> Bild Unten"161609417)
$Button1 GUICtrlCreateButton("Credits"13614459170)
$Pic1 GUICtrlCreatePic("C:\Users\philipp\Pictures\Wolfteam.jpg"88196100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###   ;==> GUI 1

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=c:\program files\koda\forms\credits.kxf
$Form1_1 GUICreate("Credits"297156193125)
$Label1 GUICtrlCreateLabel("Createt by IZEROI and help by E*Pvpers"82419617)
$Label2 GUICtrlCreateLabel("Ingame_name:  KTP106"1126411917)
$Label3 GUICtrlCreateLabel("Createt for Wolfteam"18411210117)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###   ;==> GUI 2

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit

    EndSwitch
WEnd


    
EndSwitch
WEnd

Func _Start
()
    While 
1
    Send 
("{W}")
    
Sleep (20000)
    
Send ("{S}")
    
Sleep (20000)
WEnd
EndFunc    
;==> Starten

Func _Exit
()
    Exit
EndFunc  ;==> Beenden 
10/04/2010 20:59 KingZuck#2
wie es mit dem X geht kp aber wenn du ein button machst kannst du es machen

z.B

case $exit
GUISetState(@SW_SHOW,hier der jeweilige gui)

müsste eig gehen ;D
10/04/2010 21:12 checker0899#3
Quote:
Originally Posted by KingZuck View Post
wie es mit dem X geht kp aber wenn du ein button machst kannst du es machen

z.B

case $exit
GUISetState(@SW_SHOW,hier der jeweilige gui)

müsste eig gehen ;D
okayy.. ich wills aber mit dem X ich hab kein button^^ gibt trotzdem n thx für "bemühung" :D
10/04/2010 21:42 BlackHybrid#4
So wirds gemacht ;)

PHP Code:
HotKeySet("{PGUP}""_Start")
HotKeySet("{PGDN}""_Exit") ;==> HotKeySet

#include <GUIConstants.au3>   ;==> Include

#Region ### START Koda GUI section ### Form=C:\Users\philipp\Desktop\Hack\Alle meine Scripte\KODA\Formen\Anti-Afk_Tool.kxf
$Form1 GUICreate("Anti-Afk_Tool"213192202140)
$Label1 GUICtrlCreateLabel("Start ==>  Bild Oben"161289917)
$Label2 GUICtrlCreateLabel("Exit ==> Bild Unten"161609417)
$Button1 GUICtrlCreateButton("Credits"13614459170)
$Pic1 GUICtrlCreatePic("C:\Users\philipp\Pictures\Wolfteam.jpg"88196100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###   ;==> GUI 1

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE

        
Case $Button1
            
#include <GUIConstants.au3>

            #Region ### START Koda GUI section ### Form=c:\program files\koda\forms\credits.kxf
            
$Form1_1 GUICreate("Credits"297156193125)
            
$Label1 GUICtrlCreateLabel("Createt by IZEROI and help by E*Pvpers"82419617)
            
$Label2 GUICtrlCreateLabel("Ingame_name:  KTP106"1126411917)
            
$Label3 GUICtrlCreateLabel("Createt for Wolfteam"18411210117)
            
GUISetState(@SW_SHOW)
            
#EndRegion ### END Koda GUI section ###   ;==> GUI 2

            
While 1
                $nMsg 
GUIGetMsg()
                Switch 
$nMsg
                    
Case $GUI_EVENT_CLOSE
                        GUISetState
(@SW_HIDE$Form1_1)

                EndSwitch
            
WEnd


    
EndSwitch
WEnd

Func _Start
()
    While 
1
        Send
("{W}")
        
Sleep(20000)
        
Send("{S}")
        
Sleep(20000)
    
WEnd
EndFunc   
;==>_Start

Func _Exit
()
    Exit
EndFunc   ;==>_Exit 
Wie oben schon beschrieben wurde mit dem extabutton der die variable $ende hat hat das X auch eine und zwar $GUI_EVENT_CLOSE. Das X is also praktisch ein button ;)
10/04/2010 22:44 CroSSiie#5
aaalso
dieses problem hatte ich auch lange
aber ist eigendlich ganz simple zu lösen.

Schau dir mal die Funktion
PHP Code:
GUIGetMsg() 
genauer an.

Quote:
[optional] gibt evtl. zusätzliche Informationen in einem Array zurück.
0 = (Standard) Gibt nur das Ereignis selbst zurück.
1 = Gibt ein Array zurück, in dem das Ereignis und zusätzliche Informationen enthalten sind.

Quelle: Autoit Hilfe
Jetzt wissen wir das wir zwischen 2 Moden wählen können. Aber was bringt uns das nachher?
Durch:
PHP Code:
GUIGetMsg(1
Bekommen wir ein Array zurück das genau angibt, wo das Ereignis stattfand.
Also in unserem Beispiel in welchem GUI das "X" gedrückt worden ist.

Theorie schön und gut...aber wie schaut die Praxis aus:

PHP Code:
$msg=GuiGetMsg(1)
Switch 
$msg[0]
    Case 
$GUI_EVENT_CLOSE
        
Switch $msg[1]
            Case 
$gui1
                GUISetState
(@SW_HIDE,$gui1)
            Case 
$gui2
                GUISetState
(@SW_HIDE,$gui2)
        EndSwitch
EndSwitch 
So das wäre das Script dazu das das Programm zwischen den GUIs unterscheidet.

Schauen wir uns das von oben nach unten einmal durch:
PHP Code:
$msg=GuiGetMsg(1
Die Variable $msg wird definiert mit einer Funktion die aus der Variable ein Array macht.

PHP Code:
$msg[0
Array 0: Sind die Funktionen die GUI übergreifend gewertet werden. Es also keine Rolle spielt von sie im GUI1 oder GUI2 gedrückt worden sind.

PHP Code:
$msg[1
Array 1: Wir müssen diese Variable abfragen aus welchem GUI das Ereignis kommt und können dann eine Funktion eingeben was passieren soll
(Siehe Script)


Hoffe hab es verständlich erklärt und konnte dir helfen
Gruß CroSSie
10/05/2010 13:51 checker0899#6
so jetzt habe ich folgende probs:
wenn ich beide GUI´s offen habe dann kann ich 1 schließen und das andere bleibt offen.. ABER wenn ich das andere dann auch schließen will geht es nicht zu..
ABER wenn ich die GUI2 öffne und wieder schließe dann kann ich sie nicht mehr öffnen..
10/05/2010 14:02 °Non_Public°#7
Quote:
Originally Posted by BlackHybrid View Post
PHP Code:
HotKeySet("{PGUP}""_Start")
HotKeySet("{PGDN}""_Exit") ;==> HotKeySet

#include <GUIConstants.au3>   ;==> Include

#Region ### START Koda GUI section ### Form=C:\Users\philipp\Desktop\Hack\Alle meine Scripte\KODA\Formen\Anti-Afk_Tool.kxf
$Form1 GUICreate("Anti-Afk_Tool"213192202140)
$Label1 GUICtrlCreateLabel("Start ==>  Bild Oben"161289917)
$Label2 GUICtrlCreateLabel("Exit ==> Bild Unten"161609417)
$Button1 GUICtrlCreateButton("Credits"13614459170)
$Pic1 GUICtrlCreatePic("C:\Users\philipp\Pictures\Wolfteam.jpg"88196100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###   ;==> GUI 1

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE

        
Case $Button1
            
#include <GUIConstants.au3>

            #Region ### START Koda GUI section ### Form=c:\program files\koda\forms\credits.kxf
            
$Form1_1 GUICreate("Credits"297156193125)
            
$Label1 GUICtrlCreateLabel("Createt by IZEROI and help by E*Pvpers"82419617)
            
$Label2 GUICtrlCreateLabel("Ingame_name:  KTP106"1126411917)
            
$Label3 GUICtrlCreateLabel("Createt for Wolfteam"18411210117)
            
GUISetState(@SW_SHOW)
            
#EndRegion ### END Koda GUI section ###   ;==> GUI 2

            
While 1
                $nMsg 
GUIGetMsg()
                Switch 
$nMsg
                    
Case $GUI_EVENT_CLOSE
                        GUISetState
(@SW_HIDE$Form1_1)

                EndSwitch
            
WEnd


    
EndSwitch
WEnd

Func _Start
()
    While 
1
        Send
("{W}")
        
Sleep(20000)
        
Send("{S}")
        
Sleep(20000)
    
WEnd
EndFunc   
;==>_Start

Func _Exit
()
    Exit
EndFunc   ;==>_Exit 
Code:
HotKeySet("{PGUP}", "_Start")
HotKeySet("{PGDN}", "_Exit") ;==> HotKeySet

#include <GUIConstants.au3>   ;==> Include

#Region ### START Koda GUI section ### Form=C:\Users\philipp\Desktop\Hack\Alle meine Scripte\KODA\Formen\Anti-Afk_Tool.kxf
$Form1 = GUICreate("Anti-Afk_Tool", 213, 192, 202, 140)
$Label1 = GUICtrlCreateLabel("Start ==>  Bild Oben", 16, 128, 99, 17)
$Label2 = GUICtrlCreateLabel("Exit ==> Bild Unten", 16, 160, 94, 17)
$Button1 = GUICtrlCreateButton("Credits", 136, 144, 59, 17, 0)
$Pic1 = GUICtrlCreatePic("C:\Users\philipp\Pictures\Wolfteam.jpg", 8, 8, 196, 100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###   ;==> GUI 1

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            [COLOR="Red"][B][U]GUISetState(@SW_HIDE, $Form1)[/U][/B][/COLOR]
        Case $Button1
            #include <GUIConstants.au3>

            #Region ### START Koda GUI section ### Form=c:\program files\koda\forms\credits.kxf
            $Form1_1 = GUICreate("Credits", 297, 156, 193, 125)
            $Label1 = GUICtrlCreateLabel("Createt by IZEROI and help by E*Pvpers", 8, 24, 196, 17)
            $Label2 = GUICtrlCreateLabel("Ingame_name:  KTP106", 112, 64, 119, 17)
            $Label3 = GUICtrlCreateLabel("Createt for Wolfteam", 184, 112, 101, 17)
            GUISetState(@SW_SHOW)
            #EndRegion ### END Koda GUI section ###   ;==> GUI 2

            While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                    Case $GUI_EVENT_CLOSE
                        GUISetState(@SW_HIDE, $Form1_1)

                EndSwitch
            WEnd


    EndSwitch
WEnd

Func _Start()
    While 1
        Send("{W}")
        Sleep(20000)
        Send("{S}")
        Sleep(20000)
    WEnd
EndFunc   ;==>_Start

Func _Exit()
    Exit
EndFunc   ;==>_Exit
Bei der ersten Form hast du es vergessen ;O

Vllt. geht's so besser
10/05/2010 14:13 lolkop#8
was sollen die ganzen endlos schleifen? -.-
in scripten darf man nie mehr als eine endlosschleife nutzen.

hier mal das ganze aufgeräumt:
Code:
HotKeySet ("{PGUP}", "_run")
Global $run = False, $action, $t, $credits = -1

$gui = GUICreate("Anti-Afk_Tool", 213, 192, -1, -1)
GUICtrlCreateLabel("Start ==>  Bild Oben", 16, 128, 99, 17)
GUICtrlCreateLabel("Exit ==> Bild Unten", 16, 160, 94, 17)
$Button1 = GUICtrlCreateButton("Credits", 136, 144, 59, 17, 0)
GUICtrlCreatePic("C:\Users\philipp\Pictures\Wolfteam.jpg", 8, 8, 196, 100)
GUISetState(@SW_SHOW)

While WinExists($gui)
	$msg = GUIGetMsg(1)
	Switch $msg[0]
		Case -3
			GUIDelete($msg[1])
		Case $Button1
			If Not WinExists($credits) Then
				$credits = GUICreate("Credits", 297, 156, -1, -1, 0x10C80000, -1, $gui)
				GUICtrlCreateLabel("Createt by IZEROI and help by E*Pvpers", 8, 24, 196, 17)
				GUICtrlCreateLabel("Ingame_name:  KTP106", 112, 64, 119, 17)
				GUICtrlCreateLabel("Createt for Wolfteam", 184, 112, 101, 17)
			EndIf
		Case Else
			If $run Then
				If $action And TimerDiff($t) > 20000 Then
					Send("{W}")
					$t = TimerInit()
					$action = 0
				ElseIf TimerDiff($t) > 20000 Then
					Send("{S}")
					$t = TimerInit()
					$action = 1
				EndIf
			EndIf
	EndSwitch
WEnd

Func _run()
	$run = Not $run
EndFunc
da es keine pause funktion gab, hab ich mal bild hoch als start und stop funktion gemacht
10/05/2010 15:30 PenGuin :O#9
Quote:
Originally Posted by lolkop View Post
was sollen die ganzen endlos schleifen? -.-
in scripten darf man nie mehr als eine endlosschleife nutzen.
Das würde ich vorsichtig formulieren, manchmal kommt man nicht drumherum..
Wobei ich mir da gerade nicht sicher bin, ob du bei Endlosschleife allgemein While...WEnd meinst oder nur While 1...WEnd
Weil bei While...WEnd kann man ja noch Parameterunterscheidungen machen, deshalb...
10/05/2010 19:16 lolkop#10
Quote:
Originally Posted by pinguin94 View Post
Das würde ich vorsichtig formulieren, manchmal kommt man nicht drumherum..
Wobei ich mir da gerade nicht sicher bin, ob du bei Endlosschleife allgemein While...WEnd meinst oder nur While 1...WEnd
Weil bei While...WEnd kann man ja noch Parameterunterscheidungen machen, deshalb...
mit endlos meine ich eine schleife aus der man nie herausspringt (ausser vielleicht mit exit. dann wärs immernoch ne endlos schleife).

bzw ums kurz zu machen endlos schleife = schleife die endlos läuft :P
10/05/2010 22:14 PenGuin :O#11
Also meinst du nur
While 1/True
WEnd

nicht While..WEnd im Allgemeinen, okay ;)
10/05/2010 22:25 lolkop#12
Quote:
Originally Posted by pinguin94 View Post
Also meinst du nur
While 1/True
WEnd

nicht While..WEnd im Allgemeinen, okay ;)
nein...
ich meine schleifen die endlos laufen -.-
Code:
while 1
    exitloop
wend
is eine while schleife. heist aber noch lange nicht das sie endlos läuft...

was ich meine sind schleifen wie
Code:
do
until 0
10/06/2010 13:32 PenGuin :O#13
Hab ich wohl verstanden ;O
10/06/2010 14:09 checker0899#14
so jetzt habe ich folgende probs:
wenn ich beide GUI´s offen habe dann kann ich 1 schließen und das andere bleibt offen.. ABER wenn ich das andere dann auch schließen will geht es nicht zu..
ABER wenn ich die GUI2 öffne und wieder schließe dann kann ich sie nicht mehr öffnen..
10/06/2010 14:36 omer36#15
Quote:
Originally Posted by checker0899 View Post
so jetzt habe ich folgende probs:
wenn ich beide GUI´s offen habe dann kann ich 1 schließen und das andere bleibt offen.. ABER wenn ich das andere dann auch schließen will geht es nicht zu..
ABER wenn ich die GUI2 öffne und wieder schließe dann kann ich sie nicht mehr öffnen..
also das von lolkop klappt doch normal .. .