am632 Posted November 19, 2009 Share Posted November 19, 2009 (edited) Hi, I have about 6 scripts that auto install 6 different bits of software (avg, openoffice, etc) I would like a simple gui with radio buttons, so you can tick the ones you want to install then click a run button. I have no idea where to start and Im not finding anything on the forum that seems to be what i need. please can anyone help? Edited November 19, 2009 by am632 Link to comment Share on other sites More sharing options...
Authenticity Posted November 19, 2009 Share Posted November 19, 2009 #include <GUIConstantsEx.au3> Local $hGUI, $Combo, $Btn Local $msg $hGUI = GUICreate("My GUI combo", 300, 70) $Combo = GUICtrlCreateCombo("AVG", 10, 12, 200, 25) GUICtrlSetData(-1, "OpenOffice|ETC") $Btn = GUICtrlCreateButton("Test", 220, 12, 70, 25) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $Btn Switch GUICtrlRead($Combo) Case "avg" ConsoleWrite("Installing AVG..." & @CRLF) Case "openoffice" ConsoleWrite("Installing your office..." & @CRLF) Case "ETC" ConsoleWrite("Installing ETC..." & @CRLF) Case Else ConsoleWrite("Unknown selection.." & @CRLF) EndSwitch EndSwitch WEnd Read the help file, it's from there but modified for your case. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2009 Moderators Share Posted November 19, 2009 am632,Why combo boxes? I would think "about 6" checkboxes and a "Go" button would do the job nicely. You would need to see which checkboxes were ticked by using GUICtrlRead ad then run the associated scripts.I see you have edited your post while I was typing. Radios would be as good as checkboxes - but do not use a group or you will only be able to select one at a time. Give it a go yourself and come back if you have problems.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
am632 Posted November 26, 2009 Author Share Posted November 26, 2009 Thanks guys, after research and tutorials I now have a working script, and here it is.... expandcollapse popupmsgbox(0, "Warning", "Please close any other applications before using this software") #include <GUIConstants.au3> Opt("TrayIconHide", 1) GUICreate("Main Menu", 450, 320, 310, 190) GUICtrlCreateLabel("Select your Applications: ", 40, 20) $opt1 = GUICtrlCreateCheckbox("AVG 8.5 Free", 80, 50) $opt2 = GUICtrlCreateCheckbox("OpenOffice 3.1.1", 80, 70) $opt3 = GUICtrlCreateCheckbox("Adobe Flash Player", 80, 90) $opt4 = GUICtrlCreateCheckbox("Ashampoo Burning Studio 6 FREE", 80, 110) $opt5 = GUICtrlCreateCheckbox("VLC Media Player 1.0.3", 80, 130) $opt6 = GUICtrlCreateCheckbox("Firefox 3.5.5", 80, 150) $opt7 = GUICtrlCreateCheckbox("Play Complete Sound", 180, 190) $exit = GUICtrlCreateButton("Exit", 240, 240, 60) $Option = GUICtrlCreateButton("Start", 150, 240, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $exit Then Exit Elseif $msg = $Option Then If GUICtrlRead($opt1) = 1 Then Run("DATA\AVG8-5.exe") ProcessWaitClose("AVG8-5.exe") EndIf If GUICtrlRead($opt2) = 1 Then Run("DATA\OpenOffice_3-1-1_USB_Install-XP.exe") ProcessWaitClose("OpenOffice_3-1-1_USB_Install-XP.exe") EndIf If GUICtrlRead($opt3) = 1 Then Run("DATA\Flashinstall.exe") ProcessWaitClose("Flashinstall.exe") EndIf If GUICtrlRead($opt4) = 1 Then Run("DATA\ashampooinstall.exe") ProcessWaitClose("ashampooinstall.exe") EndIf If GUICtrlRead($opt5) = 1 Then Run("DATA\vlc-1-0-3.exe") ProcessWaitClose("vlc-1-0-3.exe") EndIf If GUICtrlRead($opt6) = 1 Then Run("DATA\firefox-3-5-5.exe") ProcessWaitClose("firefox-3-5-5.exe") EndIf If GUICtrlRead($opt7) = 1 Then SoundPlay ("finished.wav",1) EndIf EndIf WEnd Link to comment Share on other sites More sharing options...
am632 Posted November 26, 2009 Author Share Posted November 26, 2009 Just 1 more question, Iv looked in the help files and searched the forum but i cant find anything/dont understand. How would i make it so 2 of the checkboxes are already 'checked' when i start the script? Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 26, 2009 Moderators Share Posted November 26, 2009 am632, $opt1 = GUICtrlCreateCheckBox{......) GUICtrlSetState(-1, $GUI_CHECKED) ; place after each creation line, -1 means last created control M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
am632 Posted November 26, 2009 Author Share Posted November 26, 2009 Thank you very much, appreciate your help Link to comment Share on other sites More sharing options...
EndFunc Posted November 29, 2009 Share Posted November 29, 2009 Thank you very much, appreciate your helpWhen you get the point of being tired of updating your script I would suggest reading from an Ini file to get the value of the AppName and the Path. So when you want to change it you don't have to update the script and recompile it. You just update the ini file and the AutoIT app is never touched. I started where you are because I wanted to run installs back to back but I quickly out grew having to modify the code. My first app was very basic. After a while I it got more efficient and due to learning how to use Arrays I took my app down from over 3000 lines of code to just a little above 900 on version 2. The app will dynamically create the check boxes and label based on what I put in the ini file. Get real familiar with Arrays, StringSplit etc. I used to hate Arrays because I feared them. LOL Now I use them for most things cause of efficiency. My app will run each app/script, then when that is done it will start the next one and so on and out put it to the console so I see what's going on. It has 3 other tabs that do stuff too. So something for you to look forward to down the road. I finished this in April 07. Took me many months to get it to where it is. Here is pic of my app. EndFuncAutoIt is the shiznit. I love it. 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