GUIs

12/24/2008 22:22 aLasca#1
Hiho, ich mal wieder :D

Also, ich habe jetzt die komplette Autoit hilfe durchforstet aber immer nur bruchteile rausgefunden.. ich hab mir auch die Au3 vom Drunkenmaster angeguckt, auch da konnte ich kaum was rauserkennen.. also kann mir mal jemand bitte erklären wie man einen GUI erstellt?

Danke im Vorraus :D
12/24/2008 22:28 xSharkoonX#2
im scite editor kannste oben bei tools kodak formdesigner auswählen und ein gui erstellen
12/24/2008 22:31 i4mSoH34Vy#3
Dann musst halt nur noch den Elementen alles zuweisen.
12/24/2008 22:36 aLasca#4
Gott seid ihr schnell, in 9 Minuten 2 Antworten O__o
Ich werd mal gucken, danke :)
12/24/2008 22:39 NBA#5
Es geht aber auch von Hand:

PHP Code:
#Include <GuiConstants.au3> ;um das Gui ueberhaubt zu ermoeglichen.

GuiCreate("Name");um das GUI zu erstellen.

GuiSetState(@SW_SHOW) ; damit das GUI angezeigt wird
So! Das ist der Anfang. Sollte man aber versuchen das zu starten, stellt man ein Problem fest: Das GUI Blinkt Kurz auf, mehr aber auch nicht.
Das loesen wir mit einer Endlosschleife:
PHP Code:
While 
$msg 
GuiGetMsg() ; Jedes mal wenn die Schleife erneuert wirdbekommt man, ;was gedrueckt wurde

If $msg $GUI_EVENT_CLOSE then exitloop
Wend 
SO! Aber etwas lehr ist das GUI schon noch.(Falls der Code oben nicht funzen sollte, prob es mit einem endif nach exitloop.)

Das beheben wir hiermit:
PHP Code:
$test GuiCtrlCreateButton("Name",x,y,laenge,hoehe
Das ist nur ein beispiel. Natuerlich kann man auch RadioButtons, Inputboxen uvm machen...

MfG
NBA

Edit:
Hier nochmal der ganze Code:

PHP Code:
#include <GuiConstants.au3>

GuiCreate("GUI")
GuiSetState(@SW_SHOW)

$button GuiCtrlCreateButton("Name",10,10,50,30) ; Laenge und Hoehe(50,30) ;werden nicht zwingend ,gebraucht, Die Var nur weil man sonst immer die CID rausfinden muss.

While 
1
$msg 
GuiGetMsg()
If 
$msg $GUI_EVENT_CLOSE then exitloop
If $msg $button then
msgbox
(0,"Es geht","Dein GUI funktioniert")
endif
Wend 
12/24/2008 22:42 kknb#6
für den anfang sind meiner meinung nach am wichtigsten:

guictrlread
guictrlsetdata
guictrlcreate

gibt natürlich wesentlich mehr...
den rest dazu spuckt dir die hilfe aus.
12/24/2008 22:49 NBA#7
Englisches Helpfile ftw!
12/24/2008 22:55 _revo#8
Quote:
Originally Posted by NBA View Post
Englisches Helpfile ftw!
sowieso ^^
12/24/2008 23:05 aLasca#9
PHP Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Icebot v1.0 by Itami, aLa$ca"633454193115)
$Button1 GUICtrlCreateButton("Run Icebot v1.0"240400145330)
$Label1 GUICtrlCreateLabel("X Coordinate Hardmode"0811717)
$Input1 GUICtrlCreateInput(""03211321)
$Label2 GUICtrlCreateLabel("Y Coordinate Hardmode"06411717)
$Input2 GUICtrlCreateInput(""08811321)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEnd

WinActivate
("Guild Wars")
Sleep(5000)
MouseClick("left"$Input1,$Input2)

Exit 
Wie kann ich in diesem Script aussagen das wenn $Button1 dann anfangen mit Winactivate Guildwars? Danke im vorraus.
12/25/2008 13:14 xSharkoonX#10
PHP Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Icebot v1.0 by Itami, aLa$ca"633454193115)
$Button1 GUICtrlCreateButton("Run Icebot v1.0"240400145330)
$Label1 GUICtrlCreateLabel("X Coordinate Hardmode"0811717)
$Input1 GUICtrlCreateInput(""03211321)
$Label2 GUICtrlCreateLabel("Y Coordinate Hardmode"06411717)
$Input2 GUICtrlCreateInput(""08811321)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
case $nMsg $Button1
Winactivate 
;..............
;
bla bla
        
Case $GUI_EVENT_CLOSE
            
Exit

    EndSwitch
WEnd

WinActivate
("Guild Wars")
Sleep(5000)
MouseClick("left"$Input1,$Input2)

Exit 
12/25/2008 13:16 aLasca#11
danke^^

€dit: das geht nicht.. er lässt mich nichts eintragen sondern macht sofort winactivate
Ich will das so machen, das er das GUI öffnet, Ich dort X,Y eingebe, und sobald ich dann auf 'Run' ($Button1) Mache, er Winactivate("Guild Wars") macht und den Hardmode anstellt.
12/25/2008 13:48 xSharkoonX#12
so habe ich das immer gemacht:
PHP Code:
While True
$MSG 
GUIGetMsg()
    
Select
    
Case $MSG == $Button1
        
;_run()
            
call("_hardmode")
    
    Case 
$MSG == $Button2
        _exitit
()
    Case 
$MSG == $Button3
        _update
()
    
EndSelect
WEnd 
kann sein das in dem anderen iwo nen fehler ist
12/25/2008 14:22 aLasca#13
was sagt das True aus?..
12/25/2008 14:45 Jacob_G#14
Das ist eine unlösbare Schleife da sie "True" ist, also geht sie unendlich lange, oder sie wird durch Befehle aufgelöst.
12/25/2008 14:48 aLasca#15
Ok danke..^^
Also, ich habe das jetzt so
PHP Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

HotKeySet("{HOME}""end")
Func end()    
    Exit
EndFunc

#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Icebot v1.0 by Itami, aLa$ca"633454193115)
$Button1 GUICtrlCreateButton("Run Icebot v1.0"240400145330)
$Label1 GUICtrlCreateLabel("X Coordinate Hardmode"0811717)
$Input1 GUICtrlCreateInput(""03211321)
$Label2 GUICtrlCreateLabel("Y Coordinate Hardmode"06411717)
$Input2 GUICtrlCreateInput(""08811321)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$msg 
GuiGetMsg()
    
Select
    
Case $msg $GUI_EVENT_CLOSE
        
Exit
    Case 
$msg $Button1
        call
("_hardmode")
    Case Else
        ;;;
    
EndSelect
WEnd

Func _hardmode
()
    
WinActivate("Guild Wars")
Sleep(5000)
MouseClick("left"$input1$input2)

Endfunc 
Nun habe ich 2 Fragen..^^ Das hardmode will ich ja nur 1x machen, aber den Run z.B. 5x
Wie mache ich das nun?

Und die 2. Frage ist wieso die Maus immer zur gleichen Stelle geht? Immer nach oben links, also (0,0)
Danke im vorraus^^ mal wieder ;)

€: Frage 2 hab ich dann grad mit GUICtrlRead geklärt :)