Sign in to follow this  
Followers 0
johns420

Dynamic Window

7 posts in this topic

In my program, I have a list of programs to install and then once the execute button is clicked another window appears with a list of the items selected to install. These items are checked off as they get done installing. I would like to make the second window be a dynamic one so that if the user only selects a few of the install options it will not be the full size. the image untitled.jpg is the main window and untitled2.jpg is the install checklist window. As you can see in untitled2.jpg there is a lot of open area, thats what i would like to fix.

Thanks for your help in advance, here is my code if itll help.

CODE
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.2.0

Author:

Script Function:

Select which software you wish to install and The program automatically does it

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#NoTrayIcon

#include <GUIConstants.au3>

HotKeySet("^c", "MyExit")

HotKeySet("^a", "SelectAll")

$mainwindow = GuiCreate("Auto Install", 260, 370)

GUICtrlCreateLabel("Select the Items you wish to install", 40,15)

GUICtrlCreateLabel("Microsoft Office 2003 Products", 50, 35)

$chkOFFICE03 = GUICtrlCreateCheckbox("Office 2003", 30, 50)

$chkFRTPAGE03 = GUICtrlCreateCheckbox("FrontPage 2003", 30, 70)

$chkVisio03 = GUICtrlCreateCheckbox("Visio 2003", 135, 70)

$chkProject03 = GUICtrlCreateCheckbox("Project 2003", 135, 50)

$chkConverter = GUICtrlCreateCheckbox("07 Converter", 75, 90)

GUICtrlCreateLabel("Basic Install", 90, 120)

$chkLN = GUICtrlCreateCheckbox("Lotus Notes 6.5.4", 30, 135)

$chkSAV = GUICtrlCreateCheckbox("SAV 1.5.5000", 30, 155)

$chkNovell = GUICtrlCreateCheckbox("Novell 4.91 SP3", 30, 175)

$chkZen = GUICtrlCreateCheckbox("Zen 6.5", 135, 135)

$chkWinZip = GUICtrlCreateCheckbox("WinZip 10", 135, 155)

$chkRoxio = GUICtrlCreateCheckbox("Roxio CD/DVD", 135, 175)

GUICtrlCreateLabel("MISC", 100, 205)

$chkAdobeRDR = GUICtrlCreateCheckbox("Adobe Reader 8", 30, 220)

$chkFlash = GUICtrlCreateCheckbox("Flash Player", 30, 240)

$chkShockwave = GUICtrlCreateCheckbox("Shockwave", 30, 260)

$chkPowerDVD = GUICtrlCreateCheckbox("Power DVD 5", 30, 280)

$chkjava142 = GUICtrlCreateCheckbox("JRE 1-4-2-14", 135, 220)

$chkjava150 = GUICtrlCreateCheckbox("JRE 1-5-0-11", 135, 240)

$chkjava6 = GUICtrlCreateCheckbox("JRE 6 Update 1", 135, 260)

$chkWinDVD = GUICtrlCreateCheckbox("Win DVD 4", 135, 280)

$chkRestart = GUICtrlCreateCheckbox("Restart Machine", 30, 310)

$btnINSTALL = GUICtrlCreateButton("Execute", 135, 310, 100, 50)

$btnAll = GUICtrlCreateButton("Select All", 30, 330, 50, 25)

$InstallWindow = GUICreate("Items to Install", 200, 410, 50, 50)

GUISwitch($mainwindow)

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg(1)

Select

Case $msg[0] = $btnAll

GUICtrlSetState($chkOffice03, $GUI_CHECKED)

GUICtrlSetState($chkFRTPAGE03, $GUI_CHECKED)

GUICtrlSetState($chkVisio03, $GUI_CHECKED)

GUICtrlSetState($chkProject03, $GUI_CHECKED)

GUICtrlSetState($chkConverter, $GUI_CHECKED)

GUICtrlSetState($chkAdobeRDR, $GUI_CHECKED)

GUICtrlSetState($chkFlash, $GUI_CHECKED)

GUICtrlSetState($chkShockwave, $GUI_CHECKED)

GUICtrlSetState($chkjava150, $GUI_CHECKED)

GUICtrlSetState($chkjava142, $GUI_CHECKED)

GUICtrlSetState($chkjava6, $GUI_CHECKED)

GUICtrlSetState($chkPowerDVD, $GUI_CHECKED)

GUICtrlSetState($chkWinDVD, $GUI_CHECKED)

GUICtrlSetState($chkLN, $GUI_CHECKED)

GUICtrlSetState($chkSAV, $GUI_CHECKED)

GUICtrlSetState($chkNovell, $GUI_CHECKED)

GUICtrlSetState($chkZen, $GUI_CHECKED)

GUICtrlSetState($chkWinZip, $GUI_CHECKED)

GUICtrlSetState($chkRoxio, $GUI_CHECKED)

GUICtrlSetState($chkRestart, $GUI_CHECKED)

Case $msg[0] = $btnINSTALL

GUIsetstate(@SW_Hide)

GUISwitch($InstallWindow)

GUISetState(@SW_SHOW)

GUISetState(@SW_DISABLE)

If GUICtrlRead($chkOffice03) = 1 Then

$insOffice03 = GUICtrlCreateCheckbox("Microsoft Office 03",10, 10)

EndIf

If GUICtrlRead($chkFRTPAGE03) = 1 Then

$insFRTPage03 = GUICtrlCreateCheckbox("Microsoft FrontPage 03",10, 30)

EndIf

If GUICtrlRead($chkVisio03) = 1 Then

$insVisio03 = GUICtrlCreateCheckbox("Microsoft Visio 03",10, 50)

EndIf

If GUICtrlRead($chkProject03) = 1 Then

$insProject03 = GUICtrlCreateCheckbox("Microsoft Project 03",10, 70)

EndIf

If GUICtrlRead($chkConverter) = 1 Then

$insConverter = GUICtrlCreateCheckbox("Office 07 Converter",10, 90)

EndIf

If GUICtrlRead($chkAdobeRDR) = 1 Then

$insAdobeRDR = GUICtrlCreateCheckbox("Adobe Reader 8",10, 110)

EndIf

If GUICtrlRead($chkFlash) = 1 Then

$insFlash = GUICtrlCreateCheckbox("Adobe Flash",10, 130)

EndIf

If GUICtrlRead($chkShockwave) = 1 Then

$insShockwave = GUICtrlCreateCheckbox("Adobe Shockwave",10, 150)

EndIf

If GUICtrlRead($chkjava142) = 1 Then

$insJava142 = GUICtrlCreateCheckbox("Java 1_4_2",10, 170)

EndIf

If GUICtrlRead($chkjava150) = 1 Then

$insJava150 = GUICtrlCreateCheckbox("Java 1_5_0",10, 190)

EndIf

If GUICtrlRead($chkjava6) = 1 Then

$insjava6 = GUICtrlCreateCheckbox("Java 6 Update 1",10, 210)

EndIf

If GUICtrlread($chkPowerDVD) = 1 Then

$insPowerDVD = GUICtrlCreateCheckbox("Power DVD",10, 230)

EndIf

If GUICtrlRead($chkWinDVD) = 1 Then

$insWinDVD = GUICtrlCreateCheckbox("WinDVD",10, 250)

EndIf

If GUICtrlRead($chkLN) = 1 Then

$insLN = GUICtrlCreateCheckbox("Lotus Notes",10, 270)

EndIf

If GUICtrlRead($chkSAV) = 1 Then

$insSAV = GUICtrlCreateCheckbox("SAV 10.1.5000",10, 290)

EndIf

If GUICtrlRead($chkNovell) = 1 Then

$insNovell = GUICtrlCreateCheckbox("Novell",10, 310)

EndIf

If GUICtrlRead($chkZen) = 1 Then

$insZen = GUICtrlCreateCheckbox("ZenWorks",10, 330)

EndIf

If GUICtrlRead($chkWinZip) = 1 Then

$insWinZip = GUICtrlCreateCheckbox("WinZip",10, 350)

EndIf

If GUICtrlRead($chkRoxio) = 1 Then

$insRoxio = GUICtrlCreateCheckbox("Roxio",10, 370)

EndIf

If GUICtrlRead($chkRestart) = 1 Then

$insRestart = GUICtrlCreateCheckbox("RESTART",10, 390)

EndIf

;~ This Section has the install settings for the programs.

$Office03State = GuiCtrlRead($chkOFFICE03)

if $Office03State = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insOffice03, $GUI_CHECKED)

EndIf

$FrontPage03State = GuiCtrlRead($chkFRTPAGE03)

If $FrontPage03State = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insFRTPAGE03, $GUI_CHECKED)

EndIf

$Visio03State = GUICtrlRead($chkVisio03)

If $Visio03State = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insVisio03, $GUI_CHECKED)

EndIf

$Project03State = GUICtrlRead($chkProject03)

If $Project03State = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insProject03, $GUI_CHECKED)

EndIf

$ConverterState = GUICtrlRead($chkConverter)

if $ConverterState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insConverter, $GUI_CHECKED)

EndIf

$AdobeRDRState = GuiCtrlRead($chkAdobeRDR)

if $AdobeRDRState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insAdobeRDR, $GUI_CHECKED)

EndIf

$FlashState = GuiCtrlRead($chkFlash)

if $FlashState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insFlash, $GUI_CHECKED)

EndIf

$ShockwaveState = GuiCtrlRead($chkShockwave)

if $ShockwaveState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insShockwave, $GUI_CHECKED)

EndIf

$java142State = GuiCtrlRead($chkjava142)

if $java142State = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insjava142, $GUI_CHECKED)

EndIf

$java150State = GuiCtrlRead($chkjava150)

if $java150State = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insjava150, $GUI_CHECKED)

EndIf

$java6State = GuiCtrlRead($chkjava6)

if $java6State = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insjava6, $GUI_CHECKED)

EndIf

$PowerDVDState = GuiCtrlRead($chkPowerDVD)

if $PowerDVDState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insPowerDVD, $GUI_CHECKED)

EndIf

$WinDVDState = GuiCtrlRead($chkWinDVD)

if $WinDVDState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insWinDVD, $GUI_CHECKED)

EndIf

$LNState = GuiCtrlRead($chkLN)

if $LNState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insLN, $GUI_CHECKED)

EndIf

$SAVState = GuiCtrlRead($chkSAV)

if $SAVState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insSAV, $GUI_CHECKED)

EndIf

$NovellState = GuiCtrlRead($chkNovell)

if $NovellState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insNovell, $GUI_CHECKED)

EndIf

$ZenState = GuiCtrlRead($chkZen)

if $ZenState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insZen, $GUI_CHECKED)

EndIf

$WinzipState = GuiCtrlRead($chkWinZip)

if $WinzipState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insWinZip, $GUI_CHECKED)

EndIf

$RoxioState = GuiCtrlRead($chkRoxio)

if $RoxioState = 1 Then

; Install This Program

sleep(250)

GUICtrlSetState($insRoxio, $GUI_CHECKED)

EndIf

;~

$RestartState = GuiCtrlRead($chkRestart)

if $RestartState = 1 Then

; Restart computer

sleep(250)

GUICtrlSetState($insRestart, $GUI_CHECKED)

endif

;~ This Code Unchecks the Checkboxes on the main form

If GUICtrlRead($chkOffice03) = 1 Then

GUICtrlSetState($chkOFFICE03, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkFRTPAGE03) = 1 Then

GUICtrlSetState($chkFRTPAGE03, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkVisio03) = 1 Then

GUICtrlSetState($chkVisio03, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkProject03) = 1 Then

GUICtrlSetState($chkProject03, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkConverter) = 1 Then

GUICtrlSetState($chkConverter, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkAdobeRDR) = 1 Then

GUICtrlSetState($chkAdobeRDR, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkFlash) = 1 Then

GUICtrlSetState($chkFlash, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkShockwave) = 1 Then

GUICtrlSetState($chkShockwave, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkjava150) = 1 Then

GUICtrlSetState($chkjava150, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkjava142) = 1 Then

GUICtrlSetState($chkjava142, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkjava6) = 1 Then

GUICtrlSetState($chkjava6, $GUI_UNCHECKED)

EndIf

If GUICtrlread($chkPowerDVD) = 1 Then

GUICtrlSetState($chkPowerDVD, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkWinDVD) = 1 Then

GUICtrlSetState($chkWinDVD, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkLN) = 1 Then

GUICtrlSetState($chkLN, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkSAV) = 1 Then

GUICtrlSetState($chkSAV, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkNovell) = 1 Then

GUICtrlSetState($chkNovell, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkZen) = 1 Then

GUICtrlSetState($chkZen, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkWinZip) = 1 Then

GUICtrlSetState($chkWinZip, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkRoxio) = 1 Then

GUICtrlSetState($chkRoxio, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkRestart) = 1 Then

GUICtrlSetState($chkRestart, $GUI_UNCHECKED)

EndIf

If GUICtrlRead($chkWinZip) = 1 Then

GUICtrlSetState($chkWinZip, $GUI_UNCHECKED)

EndIf

GUISetState(@SW_HIDE)

GUISwitch($MainWindow)

GUISetState(@SW_SHOW)

Case $msg[0] = $GUI_EVENT_CLOSE and $msg[1] = $mainwindow

Exit

ExitLoop

EndSelect

WEnd

Func MyExit()

Exit

EndFunc

Func SelectAll()

GUICtrlSetState($chkOffice03, $GUI_CHECKED)

GUICtrlSetState($chkFRTPAGE03, $GUI_CHECKED)

GUICtrlSetState($chkVisio03, $GUI_CHECKED)

GUICtrlSetState($chkProject03, $GUI_CHECKED)

GUICtrlSetState($chkConverter, $GUI_CHECKED)

GUICtrlSetState($chkAdobeRDR, $GUI_CHECKED)

GUICtrlSetState($chkFlash, $GUI_CHECKED)

GUICtrlSetState($chkShockwave, $GUI_CHECKED)

GUICtrlSetState($chkjava150, $GUI_CHECKED)

GUICtrlSetState($chkjava142, $GUI_CHECKED)

GUICtrlSetState($chkjava6, $GUI_CHECKED)

GUICtrlSetState($chkPowerDVD, $GUI_CHECKED)

GUICtrlSetState($chkWinDVD, $GUI_CHECKED)

GUICtrlSetState($chkLN, $GUI_CHECKED)

GUICtrlSetState($chkSAV, $GUI_CHECKED)

GUICtrlSetState($chkNovell, $GUI_CHECKED)

GUICtrlSetState($chkZen, $GUI_CHECKED)

GUICtrlSetState($chkWinZip, $GUI_CHECKED)

GUICtrlSetState($chkRoxio, $GUI_CHECKED)

GUICtrlSetState($chkRestart, $GUI_CHECKED)

EndFunc

post-16931-1180631617_thumb.jpg

post-16931-1180631622_thumb.jpg

Share this post


Link to post
Share on other sites



Try This:

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.2.0
Author:

Script Function:
Select which software you wish to install and The program automatically does it

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#NoTrayIcon
#include <GUIConstants.au3>

HotKeySet("^c", "MyExit")
HotKeySet("^a", "SelectAll")

$mainwindow = GuiCreate("Auto Install", 260, 370)
GUICtrlCreateLabel("Select the Items you wish to install", 40,15)

GUICtrlCreateLabel("Microsoft Office 2003 Products", 50, 35)
$chkOFFICE03 = GUICtrlCreateCheckbox("Office 2003", 30, 50)
$chkFRTPAGE03 = GUICtrlCreateCheckbox("FrontPage 2003", 30, 70)
$chkVisio03 = GUICtrlCreateCheckbox("Visio 2003", 135, 70)
$chkProject03 = GUICtrlCreateCheckbox("Project 2003", 135, 50)
$chkConverter = GUICtrlCreateCheckbox("07 Converter", 75, 90)

GUICtrlCreateLabel("Basic Install", 90, 120)
$chkLN = GUICtrlCreateCheckbox("Lotus Notes 6.5.4", 30, 135)
$chkSAV = GUICtrlCreateCheckbox("SAV 1.5.5000", 30, 155)
$chkNovell = GUICtrlCreateCheckbox("Novell 4.91 SP3", 30, 175)
$chkZen = GUICtrlCreateCheckbox("Zen 6.5", 135, 135)
$chkWinZip = GUICtrlCreateCheckbox("WinZip 10", 135, 155)
$chkRoxio = GUICtrlCreateCheckbox("Roxio CD/DVD", 135, 175)

GUICtrlCreateLabel("MISC", 100, 205)
$chkAdobeRDR = GUICtrlCreateCheckbox("Adobe Reader 8", 30, 220)
$chkFlash = GUICtrlCreateCheckbox("Flash Player", 30, 240)
$chkShockwave = GUICtrlCreateCheckbox("Shockwave", 30, 260)
$chkPowerDVD = GUICtrlCreateCheckbox("Power DVD 5", 30, 280)
$chkjava142 = GUICtrlCreateCheckbox("JRE 1-4-2-14", 135, 220)
$chkjava150 = GUICtrlCreateCheckbox("JRE 1-5-0-11", 135, 240)
$chkjava6 = GUICtrlCreateCheckbox("JRE 6 Update 1", 135, 260)
$chkWinDVD = GUICtrlCreateCheckbox("Win DVD 4", 135, 280)

$chkRestart = GUICtrlCreateCheckbox("Restart Machine", 30, 310)
$btnINSTALL = GUICtrlCreateButton("Execute", 135, 310, 100, 50)
$btnAll = GUICtrlCreateButton("Select All", 30, 330, 50, 25)

$InstallWindow = GUICreate("Items to Install", 200, 410, 50, 50)

GUISwitch($mainwindow)
GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg(1)

Select
Case $msg[0] = $btnAll
GUICtrlSetState($chkOffice03, $GUI_CHECKED)
GUICtrlSetState($chkFRTPAGE03, $GUI_CHECKED)
GUICtrlSetState($chkVisio03, $GUI_CHECKED)
GUICtrlSetState($chkProject03, $GUI_CHECKED)
GUICtrlSetState($chkConverter, $GUI_CHECKED)
GUICtrlSetState($chkAdobeRDR, $GUI_CHECKED)
GUICtrlSetState($chkFlash, $GUI_CHECKED)
GUICtrlSetState($chkShockwave, $GUI_CHECKED)
GUICtrlSetState($chkjava150, $GUI_CHECKED)
GUICtrlSetState($chkjava142, $GUI_CHECKED)
GUICtrlSetState($chkjava6, $GUI_CHECKED)
GUICtrlSetState($chkPowerDVD, $GUI_CHECKED)
GUICtrlSetState($chkWinDVD, $GUI_CHECKED)
GUICtrlSetState($chkLN, $GUI_CHECKED)
GUICtrlSetState($chkSAV, $GUI_CHECKED)
GUICtrlSetState($chkNovell, $GUI_CHECKED)
GUICtrlSetState($chkZen, $GUI_CHECKED)
GUICtrlSetState($chkWinZip, $GUI_CHECKED)
GUICtrlSetState($chkRoxio, $GUI_CHECKED)
GUICtrlSetState($chkRestart, $GUI_CHECKED)

Case $msg[0] = $btnINSTALL
GUIsetstate(@SW_Hide)
GUISwitch($InstallWindow)
GUISetState(@SW_SHOW)
GUISetState(@SW_DISABLE)
$x = 10
If GUICtrlRead($chkOffice03) = 1 Then
$insOffice03 = GUICtrlCreateCheckbox("Microsoft Office 03",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkFRTPAGE03) = 1 Then
$insFRTPage03 = GUICtrlCreateCheckbox("Microsoft FrontPage 03",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkVisio03) = 1 Then
$insVisio03 = GUICtrlCreateCheckbox("Microsoft Visio 03",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkProject03) = 1 Then
$insProject03 = GUICtrlCreateCheckbox("Microsoft Project 03",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkConverter) = 1 Then
$insConverter = GUICtrlCreateCheckbox("Office 07 Converter",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkAdobeRDR) = 1 Then
$insAdobeRDR = GUICtrlCreateCheckbox("Adobe Reader 8",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkFlash) = 1 Then
$insFlash = GUICtrlCreateCheckbox("Adobe Flash",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkShockwave) = 1 Then
$insShockwave = GUICtrlCreateCheckbox("Adobe Shockwave",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkjava142) = 1 Then
$insJava142 = GUICtrlCreateCheckbox("Java 1_4_2",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkjava150) = 1 Then
$insJava150 = GUICtrlCreateCheckbox("Java 1_5_0",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkjava6) = 1 Then
$insjava6 = GUICtrlCreateCheckbox("Java 6 Update 1",10, $x)
$x +=20
EndIf

If GUICtrlread($chkPowerDVD) = 1 Then
$insPowerDVD = GUICtrlCreateCheckbox("Power DVD",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkWinDVD) = 1 Then
$insWinDVD = GUICtrlCreateCheckbox("WinDVD",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkLN) = 1 Then
$insLN = GUICtrlCreateCheckbox("Lotus Notes",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkSAV) = 1 Then
$insSAV = GUICtrlCreateCheckbox("SAV 10.1.5000",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkNovell) = 1 Then
$insNovell = GUICtrlCreateCheckbox("Novell",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkZen) = 1 Then
$insZen = GUICtrlCreateCheckbox("ZenWorks",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkWinZip) = 1 Then
$insWinZip = GUICtrlCreateCheckbox("WinZip",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkRoxio) = 1 Then
$insRoxio = GUICtrlCreateCheckbox("Roxio",10, $x)
$x +=20
EndIf

If GUICtrlRead($chkRestart) = 1 Then
$insRestart = GUICtrlCreateCheckbox("RESTART",10, $x)
$x +=20
EndIf
GUISetState (
;~ This Section has the install settings for the programs.

$Office03State = GuiCtrlRead($chkOFFICE03)
if $Office03State = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insOffice03, $GUI_CHECKED)
EndIf

$FrontPage03State = GuiCtrlRead($chkFRTPAGE03)
If $FrontPage03State = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insFRTPAGE03, $GUI_CHECKED)
EndIf

$Visio03State = GUICtrlRead($chkVisio03)
If $Visio03State = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insVisio03, $GUI_CHECKED)
EndIf

$Project03State = GUICtrlRead($chkProject03)
If $Project03State = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insProject03, $GUI_CHECKED)
EndIf

$ConverterState = GUICtrlRead($chkConverter)
if $ConverterState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insConverter, $GUI_CHECKED)
EndIf

$AdobeRDRState = GuiCtrlRead($chkAdobeRDR)
if $AdobeRDRState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insAdobeRDR, $GUI_CHECKED)
EndIf

$FlashState = GuiCtrlRead($chkFlash)
if $FlashState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insFlash, $GUI_CHECKED)
EndIf

$ShockwaveState = GuiCtrlRead($chkShockwave)
if $ShockwaveState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insShockwave, $GUI_CHECKED)
EndIf

$java142State = GuiCtrlRead($chkjava142)
if $java142State = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insjava142, $GUI_CHECKED)
EndIf

$java150State = GuiCtrlRead($chkjava150)
if $java150State = 1 Then
; Install This Program
sleep(250)

GUICtrlSetState($insjava150, $GUI_CHECKED)
EndIf

$java6State = GuiCtrlRead($chkjava6)
if $java6State = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insjava6, $GUI_CHECKED)
EndIf

$PowerDVDState = GuiCtrlRead($chkPowerDVD)
if $PowerDVDState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insPowerDVD, $GUI_CHECKED)
EndIf

$WinDVDState = GuiCtrlRead($chkWinDVD)
if $WinDVDState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insWinDVD, $GUI_CHECKED)
EndIf

$LNState = GuiCtrlRead($chkLN)
if $LNState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insLN, $GUI_CHECKED)
EndIf

$SAVState = GuiCtrlRead($chkSAV)
if $SAVState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insSAV, $GUI_CHECKED)
EndIf

$NovellState = GuiCtrlRead($chkNovell)
if $NovellState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insNovell, $GUI_CHECKED)
EndIf

$ZenState = GuiCtrlRead($chkZen)
if $ZenState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insZen, $GUI_CHECKED)
EndIf

$WinzipState = GuiCtrlRead($chkWinZip)
if $WinzipState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insWinZip, $GUI_CHECKED)
EndIf

$RoxioState = GuiCtrlRead($chkRoxio)
if $RoxioState = 1 Then
; Install This Program
sleep(250)
GUICtrlSetState($insRoxio, $GUI_CHECKED)
EndIf
;~
$RestartState = GuiCtrlRead($chkRestart)
if $RestartState = 1 Then
; Restart computer
sleep(250)
GUICtrlSetState($insRestart, $GUI_CHECKED)
endif

;~ This Code Unchecks the Checkboxes on the main form
If GUICtrlRead($chkOffice03) = 1 Then
GUICtrlSetState($chkOFFICE03, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkFRTPAGE03) = 1 Then
GUICtrlSetState($chkFRTPAGE03, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkVisio03) = 1 Then
GUICtrlSetState($chkVisio03, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkProject03) = 1 Then
GUICtrlSetState($chkProject03, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkConverter) = 1 Then
GUICtrlSetState($chkConverter, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkAdobeRDR) = 1 Then
GUICtrlSetState($chkAdobeRDR, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkFlash) = 1 Then
GUICtrlSetState($chkFlash, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkShockwave) = 1 Then
GUICtrlSetState($chkShockwave, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkjava150) = 1 Then
GUICtrlSetState($chkjava150, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkjava142) = 1 Then
GUICtrlSetState($chkjava142, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkjava6) = 1 Then
GUICtrlSetState($chkjava6, $GUI_UNCHECKED)
EndIf

If GUICtrlread($chkPowerDVD) = 1 Then
GUICtrlSetState($chkPowerDVD, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkWinDVD) = 1 Then
GUICtrlSetState($chkWinDVD, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkLN) = 1 Then
GUICtrlSetState($chkLN, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkSAV) = 1 Then
GUICtrlSetState($chkSAV, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkNovell) = 1 Then
GUICtrlSetState($chkNovell, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkZen) = 1 Then
GUICtrlSetState($chkZen, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkWinZip) = 1 Then
GUICtrlSetState($chkWinZip, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkRoxio) = 1 Then
GUICtrlSetState($chkRoxio, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkRestart) = 1 Then
GUICtrlSetState($chkRestart, $GUI_UNCHECKED)
EndIf

If GUICtrlRead($chkWinZip) = 1 Then
GUICtrlSetState($chkWinZip, $GUI_UNCHECKED)
EndIf

GUISetState(@SW_HIDE)
GUISwitch($MainWindow)
GUISetState(@SW_SHOW)

Case $msg[0] = $GUI_EVENT_CLOSE and $msg[1] = $mainwindow
Exit
ExitLoop
EndSelect
WEnd

Func MyExit()
Exit
EndFunc

Func SelectAll()
GUICtrlSetState($chkOffice03, $GUI_CHECKED)
GUICtrlSetState($chkFRTPAGE03, $GUI_CHECKED)
GUICtrlSetState($chkVisio03, $GUI_CHECKED)
GUICtrlSetState($chkProject03, $GUI_CHECKED)
GUICtrlSetState($chkConverter, $GUI_CHECKED)
GUICtrlSetState($chkAdobeRDR, $GUI_CHECKED)
GUICtrlSetState($chkFlash, $GUI_CHECKED)
GUICtrlSetState($chkShockwave, $GUI_CHECKED)
GUICtrlSetState($chkjava150, $GUI_CHECKED)
GUICtrlSetState($chkjava142, $GUI_CHECKED)
GUICtrlSetState($chkjava6, $GUI_CHECKED)
GUICtrlSetState($chkPowerDVD, $GUI_CHECKED)
GUICtrlSetState($chkWinDVD, $GUI_CHECKED)
GUICtrlSetState($chkLN, $GUI_CHECKED)
GUICtrlSetState($chkSAV, $GUI_CHECKED)
GUICtrlSetState($chkNovell, $GUI_CHECKED)
GUICtrlSetState($chkZen, $GUI_CHECKED)
GUICtrlSetState($chkWinZip, $GUI_CHECKED)
GUICtrlSetState($chkRoxio, $GUI_CHECKED)
GUICtrlSetState($chkRestart, $GUI_CHECKED)
EndFunc

Its still could be done better on my behalf, as the size isn't set. You could fix that by parsing them as you are now, knowing what needs to be created, then make the gui with the value of $x +20 or something. I'll work on getting that done for you :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I was bored so I tried to briefen the length of the script for an example while I was at at it..lol

Also made the Select All button work as Unselect All as well (depending on state)

#NoTrayIcon
#include <GUIConstants.au3>

Global $CheckBox[21][2], $InstallBox[21], $CBState = 0
Global $spt = StringSplit("Office 2003|FrontPage 2003|07 Converter|Lotus Notes 6.5.4|SAV 1.5.5000|Novell 4.91 SP3|" & _
                            "Adobe Reader 8|Flash Player|Shockwave|Power DVD 5|Project 2003|Visio 2003|Zen 6.5|" & _
                            "WinZip 10|Roxio CD/DVD|JRE 1-4-2-14|JRE 1-5-0-11|JRE 6 Update 1|Win DVD 4|Restart Machine", "|")

$Main = GuiCreate("Auto Install", 260, 370)
GUICtrlCreateLabel("Select the Items you wish to install", 30,15)
GUICtrlCreateLabel("Microsoft Office 2003 Products", 50, 35)
GUICtrlCreateLabel("Basic Install", 90, 120)
GUICtrlCreateLabel("MISC", 100, 205)
$x = 30
$y = 50
For $c = 1 To 20
    If $c = 4 Or $c = 13 Then $y = 135
    If $c = 7 Or $c = 16 Then $y = 220
    If $c = 11 Then
        $x = 135
        $y = 50
    EndIf
    If $c = 20 Then
        $x = 30
        $y = 310
    EndIf   
    $CheckBox[$c][0] = GUICtrlCreateCheckbox($spt[$c], $x, $y)
    $y = $y + 20
Next
$btnAll = GUICtrlCreateButton("Select All", 30, 330, 70, 25)   
$btnINSTALL = GUICtrlCreateButton("Execute", 135, 310, 100, 50)
GUISetState(@SW_SHOW, $Main)

$InstallWindow = GUICreate("Items to Install", 180, -1, -1, -1, $WS_CAPTION, $WS_EX_TOPMOST, $Main)
GUISetState(@SW_DISABLE, $InstallWindow)
GUISetState(@SW_HIDE, $InstallWindow)


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $btnAll
            SelectAll()
        Case $msg = $btnINSTALL
          InstallWindow()
    EndSelect
WEnd

Func SelectAll()
    If $CBState = 0 Then
        For $all = 1 To 20
            GUICtrlSetState( $CheckBox[$all][0], $GUI_CHECKED)
        Next
        GUICtrlSetData($btnAll, "UnSelect All")
        $CBState = 1
    ElseIf $CBState = 1 Then
        For $all = 1 To 20
            GUICtrlSetState( $CheckBox[$all][0], $GUI_UNCHECKED)
        Next
        GUICtrlSetData($btnAll, "Select All")
        $CBState = 0
    EndIf
EndFunc

Func InstallWindow()
    $y1 = 5
    For $r = 1 To 20
        If GUICtrlRead($CheckBox[$r][0]) = 1 Then
            $InstallBox[$r] = GUICtrlCreateCheckbox($spt[$r],10, $y1)
            GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKSIZE)
            $y1 = $y1 + 20
        EndIf
    Next
    GUISetState(@SW_HIDE, $Main)
    GUISetState(@SW_SHOW, $InstallWindow)
    $WGP = WinGetPos($InstallWindow) ;<-- Use this to get position and size
    WinMove($InstallWindow,'', $WGP[0], $WGP[1], $WGP[2], $y1 + 40) ; <-- Use this to set the new window size
    For $DoneApps = 1 To 20
        If $InstallBox[$DoneApps] <> '' Then
            ; Install This Program
            GUICtrlSetState($InstallBox[$DoneApps], $GUI_CHECKED)
            sleep(250)
        EndIf
    Next
    For $d = 1 To 20
        GUICtrlDelete($InstallBox[$d])
        $InstallBox[$d] = 0
    Next
    GUISetState(@SW_SHOW, $Main)
    GUISetState(@SW_HIDE, $InstallWindow)
EndFunc

Cheers

Edit: removed obsolete entry.. doh

Edited by smashly

Share this post


Link to post
Share on other sites

AWESOME!!! thats perfect, thank you both so much for your help!!!!!!!!!

The unselct/select option is awesome and the install window is perfect, thank you so much.

Share this post


Link to post
Share on other sites

Hi,

Here you go I've sorta reworked the script you pm'd me.

I just added the app install code from your script into the script that's attached to this post.

Slightly changed the Main gui layout, it just made it so I could get the apps to install in the order they are selected without writing to much more code.

Added Colours to the Install gui..

The checkbox backgroung colour is:

Yellow while installing

Red if failed to find the setup files

Green and Box ticked if successful.

Fingers crossed , you should be able to run the script as is to install your apps (providing your install code was working beforehand).

Caution: Reboot Machine will do exactly that, no prompts or warnings.. forced reboot !

(thought I'd better let you know that as I caught myself out more then once while testing the updated script..Doh..lol)

Good Luck

Cheers

Share this post


Link to post
Share on other sites

It works awesome, thanks for the help. Your comments helped a lot as well with understanding what was going on.

thanks again

Share this post


Link to post
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
Sign in to follow this  
Followers 0