teunvisser Posted February 16, 2010 Share Posted February 16, 2010 (edited) Hi everyone,I've been working with autoit for a while now, and I've just yesterday started working with GUI.Since i wanted to make my script a bit more dynamic then it was.I'm making a script that makes me install all software on a pc in a fast way.This is what i have so far:#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $Button_1, $Button_2, $Button_3, $Button_4 ,$msg GUICreate("Test", 500, 500) Opt("GUICoordMode", 2) $Button_1 = GUICtrlCreateButton("Quicktime", 10, 30, 100) $Button_2 = GUICtrlCreateButton("Button Test", 0, -1) $Button_3 = GUICtrlCreateButton("Button Test", 0, -1) $Button_4 = GUICtrlCreateButton("Button Test", 0, -1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 ;New GUI window should open here but i dont know how to. EndSelect EndIf Case $msg = $Button_2 MsgBox(0, 'Testing', 'Button 2 was pressed') EndSelect WEnd EndFuncI want to make something like this:Would be really great if you guys can help me about, even if its just a bit!Thanx in advance!,Teun Edited February 16, 2010 by teunvisser Link to comment Share on other sites More sharing options...
hot202 Posted February 16, 2010 Share Posted February 16, 2010 (edited) search koda if u have the full ver of scite then it will be under tools. then create 2 guis and use GUISetState(@SW_HIDE, $GuiName) 4 the quicktime gui and then when u click the quicktime gui use GUISetState(@SW_Show, $GuiName) Edited February 16, 2010 by hot202 Link to comment Share on other sites More sharing options...
teunvisser Posted February 16, 2010 Author Share Posted February 16, 2010 search kodakoda? Link to comment Share on other sites More sharing options...
hot202 Posted February 16, 2010 Share Posted February 16, 2010 koda?Koda is a Form(gui) Designer It helps making a gui easier if u dont really know how to make them. Link to comment Share on other sites More sharing options...
teunvisser Posted February 16, 2010 Author Share Posted February 16, 2010 Koda is a Form(gui) Designer It helps making a gui easier if u dont really know how to make them.thanx hot, i've tryed it out and it is indeed a really handy program.But i still dont know how to make 2 GUI screens work together.Like when u click a button on 1 GUI screen, a second GUI screen opens which gives u more options on the perticulair button. Link to comment Share on other sites More sharing options...
hot202 Posted February 16, 2010 Share Posted February 16, 2010 really quick example there is diff ways to do it. #include <GUIConstantsEx.au3> $gui1 = GUICreate("Test", 500, 500) $Button_1 = GUICtrlCreateButton("Quicktime", 10, 30, 100) GUISetState(@SW_SHOW, $gui1) $gui2 = GUICreate("Test2", 300, 200) GUISetState(@SW_HIDE, $gui2) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 GUISetState(@SW_SHOW, $gui2) EndSelect WEnd Link to comment Share on other sites More sharing options...
Mikesch Posted February 16, 2010 Share Posted February 16, 2010 And don't forget to #include <GuiConstants.au3> if you try hot202's example in a new window. If you want the main GUI to close when the second one is shown, use: #include <guiconstants.au3> $gui1 = GUICreate("Test", 500, 500) $Button_1 = GUICtrlCreateButton("Quicktime", 10, 30, 100) GUISetState(@SW_SHOW, $gui1) $gui2 = GUICreate("Test2", 300, 200) GUISetState(@SW_HIDE, $gui2) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 GUISetState(@SW_HIDE, $gui1) GUISetState(@SW_SHOW, $gui2) EndSelect WEnd Link to comment Share on other sites More sharing options...
teunvisser Posted February 16, 2010 Author Share Posted February 16, 2010 Thanx alot! ill show you my work so far: expandcollapse popup#include <guiconstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Install_Manager = GUICreate("Install Manager", 456, 300, 190, 112) $Button1 = GUICtrlCreateButton("Quicktime", 72, 48, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Silverlight", 152, 48, 73, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Button3", 232, 48, 65, 25, $WS_GROUP) $Button4 = GUICtrlCreateButton("Button4", 304, 48, 65, 25, $WS_GROUP) GUISetState(@SW_SHOW, $Install_Manager) $Quicktime = GUICreate("Quicktime", 456, 300, 190, 112) $Button1q = GUICtrlCreateButton("Install", 80, 56, 81, 25, $WS_GROUP) $Button2q = GUICtrlCreateButton("Reinstall", 184, 56, 73, 25, $WS_GROUP) $Button3q = GUICtrlCreateButton("Deinstall", 280, 56, 65, 25, $WS_GROUP) GUISetState(@SW_HIDE, $Quicktime) $Silverlight = GUICreate("Silverlight", 456, 300, 190, 112) $Button1s = GUICtrlCreateButton("Install", 80, 56, 81, 25, $WS_GROUP) $Button2s = GUICtrlCreateButton("Reinstall", 184, 56, 73, 25, $WS_GROUP) $Button3s = GUICtrlCreateButton("Deinstall", 280, 56, 65, 25, $WS_GROUP) GUISetState(@SW_HIDE, $Silverlight) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 GUISetState(@SW_HIDE, $Install_Manager) GUISetState(@SW_SHOW, $Quicktime) GUISetState(@SW_HIDE, $Silverlight) Case $msg = $Button2 GUISetState(@SW_HIDE, $Install_Manager) GUISetState(@SW_HIDE, $Quicktime) GUISetState(@SW_SHOW, $Silverlight) EndSelect WEnd Pretty Sweet Link to comment Share on other sites More sharing options...
teunvisser Posted February 16, 2010 Author Share Posted February 16, 2010 Thanx alot! ill show you my work so far: expandcollapse popup#include <guiconstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Install_Manager = GUICreate("Install Manager", 456, 300, 190, 112) $Button1 = GUICtrlCreateButton("Quicktime", 72, 48, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Silverlight", 152, 48, 73, 25, $WS_GROUP) $Button3 = GUICtrlCreateButton("Button3", 232, 48, 65, 25, $WS_GROUP) $Button4 = GUICtrlCreateButton("Button4", 304, 48, 65, 25, $WS_GROUP) GUISetState(@SW_SHOW, $Install_Manager) $Quicktime = GUICreate("Quicktime", 456, 300, 190, 112) $Button1q = GUICtrlCreateButton("Install", 80, 56, 81, 25, $WS_GROUP) $Button2q = GUICtrlCreateButton("Reinstall", 184, 56, 73, 25, $WS_GROUP) $Button3q = GUICtrlCreateButton("Deinstall", 280, 56, 65, 25, $WS_GROUP) GUISetState(@SW_HIDE, $Quicktime) $Silverlight = GUICreate("Silverlight", 456, 300, 190, 112) $Button1s = GUICtrlCreateButton("Install", 80, 56, 81, 25, $WS_GROUP) $Button2s = GUICtrlCreateButton("Reinstall", 184, 56, 73, 25, $WS_GROUP) $Button3s = GUICtrlCreateButton("Deinstall", 280, 56, 65, 25, $WS_GROUP) GUISetState(@SW_HIDE, $Silverlight) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 GUISetState(@SW_HIDE, $Install_Manager) GUISetState(@SW_SHOW, $Quicktime) GUISetState(@SW_HIDE, $Silverlight) Case $msg = $Button2 GUISetState(@SW_HIDE, $Install_Manager) GUISetState(@SW_HIDE, $Quicktime) GUISetState(@SW_SHOW, $Silverlight) EndSelect WEnd Pretty Sweet Now here is a script to check if a program is installed: Const $INSTALLSTATE_ABSENT = 2, $INSTALLSTATE_ADVERTISED = 1 Const $INSTALLSTATE_DEFAULT = 5, $INSTALLSTATE_INVALIDARG = -2 Const $INSTALLSTATE_UNKNOWN = -1 $prodName = "Microsoft Office Professional Editie 2003" $prodCode = "{90110413-6000-11D3-8CFE-0150048383C9}" $IsInstalled = DllCall("msi.dll", "int", "MsiQueryProductStateA", "str", $prodCode) Select Case $IsInstalled[0] = $INSTALLSTATE_ABSENT $msg = " is installed for a different user." Case $IsInstalled[0] = $INSTALLSTATE_ADVERTISED $msg = " is advertised." Case $IsInstalled[0] = $INSTALLSTATE_UNKNOWN $msg = " is not installed." Case $IsInstalled[0] = $INSTALLSTATE_DEFAULT $msg = " is installed." Case Else $msg = ": The program's install state could not be determined." EndSelect MsgBox(0, "Install Test", $prodName & $msg) How would I be able to make this work in a GUI code. I know its kinda hard.. thats why i'm asking you guys! Tnx for any help u can give me, Teun Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now