Jump to content

Gui for installers


heathy
 Share

Recommended Posts

So far I've made a script that will install all the "required" software on my machines. It's pretty much all unattended and comes with my XP slipstream.

Now cause people want options to not install certain software I'm making a menu of sorts of what to install or not install. So far I have script with with 3 check boxes that so far listen to what I say. The one issue I'm running into is making it wait for one installer to end before it goes to the next. Right now it just opens everything that resides in my 2nd while statement. I was thinking about making a lot of wait statements within the if statements for each check box. I was wondering if someone might have a better sloution for my issue. I know my code is fairly crude so hopefully i'll understand any suggestions given. Thanks in advanced and here is the code I have right now.

-- START

#include "GUIConstants.au3"

;Create Window
GUICreate("ESS Software", 400, 200)
GUICtrlCreateLabel("What software would you like to install?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 100, 100, 60, 30)
GuiSetState(@SW_SHOW)

;Create CheckBoxes
$check1 = GUICtrlCreateCheckbox ("CMD", 30, 30, 90, 30)
$check2 = GUICtrlCreateCheckbox ("MEdia Player", 30, 60, 80, 20)
$check3 = GUICtrlCreateCheckbox ("Calculator", 30, 90, 80, 20)

;Check Box Responses
GUISetState ()

While 1
  $msg = GUIGetMsg()
  If $msg = $okbutton then ExitLoop
Wend

While 2

  IF GUIRead($check1) = $GUI_CHECKED THEN 
    Run("cmd.exe", "", @SW_MAXIMIZE)

  ElseIf GUIRead($check1) = $GUI_UNCHECKED THEN 
  EndIf

  IF GUIRead($check2) = $GUI_CHECKED THEN 
    Run("mplay32.exe", "", @SW_MAXIMIZE)
  ElseIf GUIRead($check2) = $GUI_UNCHECKED THEN 
  EndIf

  IF GUIRead($check3) = $GUI_CHECKED THEN 
    Run("calc.exe", "", @SW_MAXIMIZE)
  ElseIf GUIRead($check3) = $GUI_UNCHECKED THEN 
  EndIf

  ExitLoop
Wend
GUIDelete()

--END

Edited by Larry
Link to comment
Share on other sites

Untested but might work. The key is using RunWait.... but I was also trying to make the code as concise as possible :)

#include "GUIConstants.au3"

;Create Window
GUICreate("ESS Software", 400, 200)
GUICtrlCreateLabel("What software would you like to install?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 100, 100, 60, 30)

;Create CheckBoxes
$check1 = GUICtrlCreateCheckbox ("CMD", 30, 30, 90, 30)
$check2 = GUICtrlCreateCheckbox ("MEdia Player", 30, 60, 80, 20)
$check3 = GUICtrlCreateCheckbox ("Calculator", 30, 90, 80, 20)

; Show GUI, and wait for OK to be pressed
GUISetState ()
While GuiGetMsg() <> $okbutton
Wend
GuiDelete();get rid of GUI right away; this is optional

If GUIRead($check1) = $GUI_CHECKED THEN RunWait("cmd.exe", "", @SW_MAXIMIZE)
If GUIRead($check2) = $GUI_CHECKED THEN RunWait("mplay32.exe", "", @SW_MAXIMIZE)
If GUIRead($check3) = $GUI_CHECKED THEN RunWait("calc.exe", "", @SW_MAXIMIZE)

Exit
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Sweet. :) It does what I need. I have a question about one of the lines. In my script I had a crude wait statement to wait for the ok button to be pressed. Yours has While GuiGetMsg() <> $okbutton, could you explain the function of <>.

Thanks for your help.

HY

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...