Problem mit Buttons

10/03/2010 10:44 Tjuny#1
Hey leute bin anfänger in autoit und möchte es so machen das wenn man auf den Button beenden klickt sich das fenster schließt aber irgendwie klappt das nicht so ganz hier einmal mein code:


#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Start", 625, 443, 193, 125)
GUISetBkColor(0x3399FF)
$Button1 = GUICtrlCreateButton("Beenden", 0, 424, 81, 17, 0)
GUICtrlSetBkColor(-1, 0x800000)
$Button2 = GUICtrlCreateButton("Einloggen", 208, 160, 193, 97, 0)
GUICtrlSetBkColor(-1, 0x808000)
$Button3 = GUICtrlCreateButton("Homepage", 488, 0, 121, 33, 0)
GUICtrlSetBkColor(-1, 0x800080)
$Button4 = GUICtrlCreateButton("Account Erstellen", 0, 0, 161, 57, 0)
GUICtrlSetBkColor(-1, 0x008000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

EndSwitch
WEnd
If GuiGetMsg() = $Beenden then
Send ("!{F4}")
EndIf




Würde mich freuen wenn ihr mir helfen könntet..
10/03/2010 10:53 BlackHybrid#2
So macht mans :D


PHP Code:
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Start"625443193125)
GUISetBkColor(0x3399FF)
$Button1 GUICtrlCreateButton("Beenden"042481170)
GUICtrlSetBkColor(-10x800000)
$Button2 GUICtrlCreateButton("Einloggen"208160193970)
GUICtrlSetBkColor(-10x808000)
$Button3 GUICtrlCreateButton("Homepage"4880121330)
GUICtrlSetBkColor(-10x800080)
$Button4 GUICtrlCreateButton("Account Erstellen"00161570)
GUICtrlSetBkColor(-10x008000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg 
GUIGetMsg()
Switch 
$nMsg
    
Case $GUI_EVENT_CLOSE
        
exit
    case 
$Button1
        
exit
EndSwitch
WEnd 
10/03/2010 11:04 Tjuny#3
Danke und wenn ich dann die Homepage öffnen möchte wie mache ich das?
so?


While 2
$nMsg = GUIGetMsg()
Switch $nMsg
Run ("C:\Program Files\Mozilla Firefox\firefox")
WinWaitActive ("www.xxx.de")das ist glaub ich falsch
case $Button3
exit
EndSwitch
WEnd
exit
EndSwitch
WEnd

oder auch wieder ein Fehler?
Bitte um Hilfe
Gebe gerne Thanks ;)
10/03/2010 11:11 BlackHybrid#4
Ich habs immer mit Dos gemacht weil er da soweit ich weis deinen standard Browser nimmt.

PHP Code:
#include <Process.au3>
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Start"625443193125)
GUISetBkColor(0x3399FF)
$Button1 GUICtrlCreateButton("Beenden"042481170)
GUICtrlSetBkColor(-10x800000)
$Button2 GUICtrlCreateButton("Einloggen"208160193970)
GUICtrlSetBkColor(-10x808000)
$Button3 GUICtrlCreateButton("Homepage"4880121330)
GUICtrlSetBkColor(-10x800080)
$Button4 GUICtrlCreateButton("Account Erstellen"00161570)
GUICtrlSetBkColor(-10x008000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg 
GUIGetMsg()
Switch 
$nMsg
    
Case $GUI_EVENT_CLOSE
        
exit
    case 
$Button1
        
exit
    Case 
$Button3
        _RunDos
("start http://www.google.de/")
EndSwitch
WEnd 
PS: Wenn du Etwas mit Buttons machst mach es immer in dem Prinzip weiter also erst Case und dann unten drunter was gemacht werden soll
10/03/2010 11:19 Tjuny#5
Irgendetwas muss falsch sein er zeigt mir jetzt Error: Unknown funktion name
10/03/2010 11:22 omer36#6
PHP Code:
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Start"625443193125)
GUISetBkColor(0x3399FF)
$Button1 GUICtrlCreateButton("Beenden"042481170)
GUICtrlSetBkColor(-10x800000)
$Button2 GUICtrlCreateButton("Einloggen"208160193970)
GUICtrlSetBkColor(-10x808000)
$Button3 GUICtrlCreateButton("Homepage"4880121330)
GUICtrlSetBkColor(-10x800080)
$Button4 GUICtrlCreateButton("Account Erstellen"00161570)
GUICtrlSetBkColor(-10x008000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg 
GUIGetMsg()
Switch 
$nMsg
    
Case $GUI_EVENT_CLOSE
        
exit
    case 
$Button1
        
exit
    Case 
$Button3
        ShellExecute
("www.google.de")
EndSwitch
WEnd 
wobei es mit _RunDos auch gehen müsste...
in welcher zeile ist den der error?
10/03/2010 11:23 BlackHybrid#7
Du musst auch die #include <Process.au3> Includen wie ich es oben gemacht hab da der befehl in der Include deklariert wird.
10/03/2010 11:26 Tjuny#8
Danke danke klappt jetzt habt nen Thanks ;)
10/03/2010 19:48 Tjuny#9
Eine Frage hätte ich da doch noch wie pausiere ich meinen script?
Also könntet ihr mir bitte den code hierzu schreiben das wäre echt super ;
Es muss zu Button 5
Gebe gerne Thanks wenns klappt ;)

$Form1 = #include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
GUICreate("Start", 625, 443, 193, 125)
GUISetBkColor(0x3399FF)
$Button1 = GUICtrlCreateButton("Beenden", 0, 424, 81, 17, 0)
GUICtrlSetBkColor(-1, 0x800000)
$Button2 = GUICtrlCreateButton("Einloggen", 208, 160, 193, 97, 0)
GUICtrlSetBkColor(-1, 0x808000)
$Button3 = GUICtrlCreateButton("Unsere Homepage", 488, 0, 121, 33, 0)
GUICtrlSetBkColor(-1, 0x800080)
$Button4 = GUICtrlCreateButton("Account Erstellen", 0, 0, 161, 57, 0)
GUICtrlSetBkColor(-1, 0x008000)
$Button5 = GUICtrlCreateButton("Stop Bot", 560, 112, 65, 177, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
GUISetState(@SW_SHOW)
#EndRegion ### END K$oda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
exit
case $Button1
exit
Case $Button3
ShellExecute ("http://www.google.de/")
Case $Button4
ShellExecute ("http://www.google.de/")
EndSwitch
WEnd
10/03/2010 19:55 BlackHybrid#10
Wenn du mir sagst, was pausiert werden soll kann ich dir gerne helfen ;)
Ansonsten kann ich dir nur meine oft verwendete Pausefunktion ans Herz legen :D

PHP Code:
Global $paused
$Form1 
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
GUICreate("Start"625443193125)
GUISetBkColor(0x3399FF)
$Button1 GUICtrlCreateButton("Beenden"042481170)
GUICtrlSetBkColor(-10x800000)
$Button2 GUICtrlCreateButton("Einloggen"208160193970)
GUICtrlSetBkColor(-10x808000)
$Button3 GUICtrlCreateButton("Unsere Homepage"4880121330)
GUICtrlSetBkColor(-10x800080)
$Button4 GUICtrlCreateButton("Account Erstellen"00161570)
GUICtrlSetBkColor(-10x008000)
$Button5 GUICtrlCreateButton("Stop Bot"560112651770)
GUICtrlSetBkColor(-10xFFFF00)
GUISetState(@SW_SHOW)
#EndRegion ### END K$oda GUI section ###

While 1
$nMsg 
GUIGetMsg()
Switch 
$nMsg
Case $GUI_EVENT_CLOSE
exit
case 
$Button1
exit
Case 
$Button3
ShellExecute 
("http://www.google.de/")
Case 
$Button4
ShellExecute 
("http://www.google.de/")
Case 
$Button5
$paused 
Not $paused
While $paused
Sleep
(50)
EndSwitch
WEnd 
Allerdings funktioniert das wenn du eine while schleife oder sonstiges hast nurnoch mit hotkeys
10/03/2010 20:17 Tjuny#11
Einfach nur das der Script pausiert ist..meinte ich damit ..
Irgendwie klappt das mit deinem code nicht so ganz ...
No matching Switch steht dort
10/03/2010 20:48 BlackHybrid#12
Ja habs WEnd vergessen so musses aussehen dasses klappt
PHP Code:
Global $paused
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
GUICreate("Start"625443193125)
GUISetBkColor(0x3399FF)
$Button1 GUICtrlCreateButton("Beenden"042481170)
GUICtrlSetBkColor(-10x800000)
$Button2 GUICtrlCreateButton("Einloggen"208160193970)
GUICtrlSetBkColor(-10x808000)
$Button3 GUICtrlCreateButton("Unsere Homepage"4880121330)
GUICtrlSetBkColor(-10x800080)
$Button4 GUICtrlCreateButton("Account Erstellen"00161570)
GUICtrlSetBkColor(-10x008000)
$Button5 GUICtrlCreateButton("Stop Bot"560112651770)
GUICtrlSetBkColor(-10xFFFF00)
GUISetState(@SW_SHOW)
#EndRegion ### END K$oda GUI section ###

While 1
$nMsg 
GUIGetMsg()
Switch 
$nMsg
Case $GUI_EVENT_CLOSE
exit
case 
$Button1
exit
Case 
$Button3
ShellExecute 
("http://www.google.de/")
Case 
$Button4
ShellExecute 
("http://www.google.de/")
Case 
$Button5
$paused 
Not $paused
While $paused
Sleep
(50)
wend
EndSwitch
WEnd 
Trotzdem wüsste ich gerne was du pausieren willst das einzige was du da pausieren kannst is die Abfrage, ob ein Button gedrückt wurde.
10/04/2010 15:39 Tjuny#13
Geht es das man so pausiert das man nichts mehr klicken kann und dann halt noch nen Button macht wo es weiter geht?oder beides in einem?
10/04/2010 15:49 BlackHybrid#14
Müsste dann so aussehen:

PHP Code:
Global $paused 1
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
GUICreate("Start"625443193125)
GUISetBkColor(0x3399FF)
$Button1 GUICtrlCreateButton("Beenden"042481170)
GUICtrlSetBkColor(-10x800000)
$Button2 GUICtrlCreateButton("Einloggen"208160193970)
GUICtrlSetBkColor(-10x808000)
$Button3 GUICtrlCreateButton("Unsere Homepage"4880121330)
GUICtrlSetBkColor(-10x800080)
$Button4 GUICtrlCreateButton("Account Erstellen"00161570)
GUICtrlSetBkColor(-10x008000)
$Button5 GUICtrlCreateButton("Stop Bot"560112651770)
GUICtrlSetBkColor(-10xFFFF00)
GUISetState(@SW_SHOW)
#EndRegion ### START Koda GUI section ### Form=

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            
Exit
        Case 
$Button3
            ShellExecute
("http://www.google.de/")
        Case 
$Button4
            ShellExecute
("http://www.google.de/")
        Case 
$Button5

            
If $paused 1 Then
                GUICtrlSetState
($Button1$GUI_DISABLE)
                
GUICtrlSetState($Button2$GUI_DISABLE)
                
GUICtrlSetState($Button3$GUI_DISABLE)
                
GUICtrlSetState($Button4$GUI_DISABLE)
                
$Paused -= 1
            
ElseIf $paused 0 Then
                GUICtrlSetState
($Button1$GUI_ENABLE)
                
GUICtrlSetState($Button2$GUI_ENABLE)
                
GUICtrlSetState($Button3$GUI_ENABLE)
                
GUICtrlSetState($Button4$GUI_ENABLE)
                
$Paused += 1
            
EndIf
    EndSwitch
WEnd 
10/04/2010 16:04 Tjuny#15
Danke Danke hast glaub ich überall nen Thanks :):):)