Sign in to follow this  
Followers 0
pcjames

Help Making Software Installion Wizzard

8 posts in this topic

Hi All,

In the last two years I have put together unattended installation scripts and I have made a main autoit script to pull in all the software installation scripts that I want to go a certain operating system and I have to go through and deselect certain software depending on if it has a cd/dvd/rw or not and also deselect software if the customer brings in theirs. I've been working on a GUI that would allow me to 1st select the operating system and then select a certain predefined installation package and then showing the available software to select or deselect.

I have read & read the help pages as well as reading forums going on to close to a year now and I'm just not getting it, I hope someone can help me with this and I do understand better from example when it's explained to me. I am posting what I have so far and I know it's really incomplete but it's what I have so far.

#include <GuiConstantsEx.au3>

Opt("GUIoneventmode", 1)
Opt('MustDeclareVars', 1)


; Declaratins 

dim $cancel
dim $combo1

dim $w2k
dim $w2kHBI
dim $w2kHSI
dim $wXPH32
dim $wXPH32HBI
dim $wXPH32HSI
dim $wXPP32
dim $wXPP32HBI
dim $wXPP32HSI


dim $app1
dim $app2
dim $app3
dim $app4

; Select Operating System Drop Down Box

GUICreate("Software Installation Wizard", 300, 140)
GUICtrlCreateLabel("Please Select your Operating System.", 26, 8, 300, 17)
$combo1 = GUICtrlCreateCombo("Please Select", 32, 40, 250, 25)
GUICtrlSetData(-1, "Windows 2000 Professional|Windows XP Home 32-Bit |Windows XP Professional 32-Bit |")
GUICtrlCreateButton("Next", 16, 80, 97, 25, 0)
GUICtrlSetOnEvent(-1,"getos")
GUICtrlCreateButton("Cancel", 188, 80, 97, 25, 0)
GUICtrlSetOnEvent(-1, "cancel")
GUISetState(@SW_SHOW)


; Select the Operating System
Func getos()
 Local $OS = GUICtrlRead($combo1)
    Select 
        Case $OS = "Windows 2000 Professional"
          w2k()
        Case $OS = "Windows XP Home 32-Bit"
          wxph32()
        Case $OS = "Windows XP Professional 32-Bit"
          wxpp32()  
    EndSelect
EndFunc


; Windows 2000 Professional
Func w2k()
GUISetState(@SW_Hide)
GUICreate("Software Installation Wizard", 675, 350)
GUICtrlCreateLabel("Windows 2000 Professional" & " Software Installation Wizard", 10, 8, 645, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Please select the software package you want to install", 10, 40, 645, 24)
$w2kHBI = GUICtrlCreateCheckbox("Home Basic", 10,65)
GUICtrlSetTip($w2kHBI,"Windows 2000 Professional - Home Basic Installation.")
$w2kHSI = GUICtrlCreateCheckbox("Home Security",150,65)
GUICtrlSetTip($w2kHSI,"Windows 2000 Professional - Home Security Installation.")
GUICtrlCreateLabel("Or select the software you want to install", 10, 95, 645, 24)
$app1 = GUICtrlCreateCheckbox ("Adobe Reader 7.2", 10,120) 
$app2 = GUICtrlCreateCheckbox ("ATF", 10,145)
$app3 = GUICtrlCreateCheckbox ("CCleaner", 10,170)
$app4 = GUICtrlCreateCheckbox ("DVD Identifier", 10,195)
GUICtrlCreateButton("Back", 414, 310, 73, 25, 0)
GUICtrlCreateButton("Next", 497, 310, 73, 25, 0)
GUICtrlCreateButton("Cancel", 580, 310, 73, 25, 0)
GUICtrlSetOnEvent(-1, "cancel")
GUISetState(@SW_SHOW)
EndFunc

; Windows XP Home 32-Bit
Func wxph32()
GUISetState(@SW_Hide)
GUICreate("Software Installation Wizard", 675, 350)
GUICtrlCreateLabel("Windows XP Home 32-Bit" & " Software Installation Wizard", 30, 8, 600, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Please select the software package you want to install", 10, 40, 645, 24)
$wxph32HBI = GUICtrlCreateCheckbox("Home Basic", 10,65)
GUICtrlSetTip($wxph32HBI,"Windows XP Home 32-Bit - Home Basic Installation.")
$wxph32HSI = GUICtrlCreateCheckbox("Home Security",150,65)
GUICtrlSetTip($wxph32HSI,"Windows XP Home 32-Bit - Home Security Installation.")
GUICtrlCreateLabel("Or select the software you want to install", 10, 95, 645, 24)
$app1 = GUICtrlCreateCheckbox ("Adobe Reader X", 10,120) ;l,t, w,h
$app2 = GUICtrlCreateCheckbox ("ATF", 10,145)
$app3 = GUICtrlCreateCheckbox ("CCleaner", 10,170)
$app4 = GUICtrlCreateCheckbox ("DVD Identifier", 10,195)
GUICtrlCreateButton("Back", 414, 310, 73, 25, 0)
GUICtrlCreateButton("Next", 497, 310, 73, 25, 0)
GUICtrlCreateButton("Cancel", 580, 310, 73, 25, 0)
GUICtrlSetOnEvent(-1, "cancel")
GUISetState(@SW_SHOW)
EndFunc

; Windows XP Professional 32-Bit
Func wxpp32()
GUISetState(@SW_Hide)
GUICreate("Software Installation Wizard", 675, 350)
GUICtrlCreateLabel("Windows XP Professional 32-Bit" & " Software Installation Wizard", 10, 8, 600, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Please select the software package you want to install", 10, 40, 645, 24)
$wxpp32HBI = GUICtrlCreateCheckbox("Home Basic", 10,65)
GUICtrlSetTip($wxpp32HBI,"Windows XP Professional 32-Bit - Home Basic Installation.")
$wxpp32HSI = GUICtrlCreateCheckbox("Home Security",150,65)
GUICtrlSetTip($wxpp32HSI,"Windows XP Professional 32-Bit - Home Security Installation.")
GUICtrlCreateLabel("Or select the software you want to install", 10, 95, 645, 24)
$app1 = GUICtrlCreateCheckbox ("Adobe Reader X", 10,120)
$app2 = GUICtrlCreateCheckbox ("ATF", 10, 90, 160, 30)
$app3 = GUICtrlCreateCheckbox ("CCleaner", 10, 115, 160, 30)
$app4 = GUICtrlCreateCheckbox ("DVD Identifier", 10, 140, 160, 30)
GUICtrlCreateButton("Back", 414, 310, 73, 25, 0)
GUICtrlCreateButton("Next", 497, 310, 73, 25, 0)
GUICtrlCreateButton("Cancel", 580, 310, 73, 25, 0)
GUICtrlSetOnEvent(-1, "cancel")
GUISetState(@SW_SHOW)
EndFunc

; Install Packages Checkbox Tips
GUICtrlSetTip($w2kHBI,"Windows 2000 Professional - Home Basic Installation.")
GUICtrlSetTip($w2kHSI,"Windows 2000 Professional - Home Security Installation.")
GUICtrlSetTip($wXPH32HBI,"Windows XP Home 32-Bit - Home Basic Installation.")
GUICtrlSetTip($wXPH32HSI,"Windows XP Home 32-Bit - Home Security Installation.")
GUICtrlSetTip($wXPP32HBI,"Windows XP PRO 32-Bit - Home Basic Installation.")
GUICtrlSetTip($wXPP32HSI,"Windows XP PRO 32-Bit - Home Security Installation.")


; Cancel then Exit the program
Func Cancel()
  Local $Cancel 
    $Cancel = MsgBox(262452,"Cancel","Are you sure you want to Cancel?")
    If $Cancel = 6 Then
    Exit
    Endif
EndFunc

While 1
sleep(10)
WEnd

Thanks in advance for any all all help!

James

Share this post


Link to post
Share on other sites



I hope this is of some use for you. I can't do much more with it without more info.

Keep in mind that you should always try to declare variables in the Local, or Global scope, avoid using Dim to do so and try to use descriptive naming.

If you have multiple functions that are 80% the same, you can probably use 1 function and add some code to change the stuff that needs to change.

#include <GuiConstantsEx.au3>

Opt("GUIoneventmode", 1)
Opt('MustDeclareVars', 1)


Global $GUIMain, $GUISelect, $GUIProgress, $CtrlCombo, $aCtrls[1]
Global $sOpSys, $aApplications

Global $aSoftware_2K[4] = ["Adobe Reader 7.2","ATF","CCleaner","DVD Identifier"] ;You could hardcode these, or read em from an ini file.
Global $aSoftware_XP_H32[4] = ["Adobe Reader X","ATF","CCleaner","DVD Identifier"]
Global $aSoftware_XP_P32[4] = ["Adobe Reader X","ATF","CCleaner","DVD Identifier"]

;It might be more practical detecting the OS automatically.
$GUIMain = GUICreate("Software Installation Wizard", 300, 140)
GUISetOnEvent(-3,"_Exit")
GUICtrlCreateLabel("Please Select your Operating System.", 26, 8, 300, 17)
$CtrlCombo = GUICtrlCreateCombo("Please Select", 32, 40, 250, 25)
GUICtrlSetData(-1, "Windows 2000 Professional|Windows XP Home 32-Bit|Windows XP Professional 32-Bit|")
GUICtrlCreateButton("Next", 16, 80, 97, 25, 0)
GUICtrlSetOnEvent(-1,"_GetOs")
GUICtrlCreateButton("Cancel", 188, 80, 97, 25, 0)
GUICtrlSetOnEvent(-1, "_Exit")
GUISetState(@SW_SHOW)

; Select the Operating System
Func _GetOs()
    $sOpSys = GUICtrlRead($CtrlCombo)
    Select
        Case $sOpSys = "Windows 2000 Professional"
         $aApplications = $aSoftware_2K
        Case $sOpSys = "Windows XP Home 32-Bit"
         $aApplications = $aSoftware_XP_H32
        Case $sOpSys = "Windows XP Professional 32-Bit"
         $aApplications = $aSoftware_XP_P32
    EndSelect
    Global $aCtrls[UBound($aApplications)+2]

    ;instead of a choice out of 3 GUI's we can just adjust one. This also allows you to add additional software packages and operating systems easily.
    $GUISelect = GUICreate("Software Installation Wizard", 675, 350)
    GUICtrlCreateLabel($sOpSys & " Software Installation Wizard", 10, 8, 645, 24)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

    ;I assumed you will always have exactly 2 package type options.
    GUICtrlCreateLabel("Please select the software package you want to install", 10, 40, 645, 24)
    $aCtrls[0] = GUICtrlCreateCheckbox("Home Basic", 10,65)
    GUICtrlSetTip(-1,$sOpSys & " - Home Basic Installation.")
    $aCtrls[1] = GUICtrlCreateCheckbox("Home Security",150,65)
    GUICtrlSetTip(-1,$sOpSys & " - Home Security Installation.")

    GUICtrlCreateLabel("Or select the software you want to install", 10, 95, 645, 24)

    ;Any amount of software should work, but you mai need to resize your GUI if there are allot.
    For $i = 0 To UBound($aApplications)-1
        $aCtrls[$i+2] = GUICtrlCreateCheckbox ($aApplications[$i], 10,120 + $i*25)
    Next

    GUICtrlCreateButton("Back", 414, 310, 73, 25, 0)
    GUICtrlSetOnEvent(-1, "_Back")
    GUICtrlCreateButton("Next", 497, 310, 73, 25, 0)
    GUICtrlSetOnEvent(-1, "_InstallSoftWare")
    GUICtrlCreateButton("Cancel", 580, 310, 73, 25, 0)
    GUICtrlSetOnEvent(-1, "_Exit")

    GUISetState(@SW_Hide, $GUIMain)
    GUISetState(@SW_SHOW, $GUISelect)
EndFunc

Func _Exit()
    If MsgBox(262452,"Cancel","Are you sure you want to Cancel?") = 6 Then Exit
EndFunc

Func _Back()
    If WinExists($GUISelect) Then
        GUIDelete($GUISelect)
        GUISetState(@SW_SHOW, $GUIMain)
    EndIf
EndFunc

; I don't know what the next step of installation is. Do you have seperate exe's for the installations, or functions?

Func _InstallSoftWare()
    Local $sInstall
    ;again I assume 2 packages...
    If GUICtrlRead($aCtrls[0]) = 1 Then $sInstall &= $sOpSys & " - Home Basic Installation." & @CRLF
    If GUICtrlRead($aCtrls[1]) = 1 Then $sInstall &= $sOpSys & " - Home Security Installation." & @CRLF
    
    ;...and an unknown number of seperate software.
    For $i = 0 To UBound($aApplications)-1
        If GUICtrlRead($aCtrls[$i+2]) = 1 Then $sInstall &= $aApplications[$i] & @CRLF
    Next
    
    If $sInstall Then
        MsgBox(0,"Installing:",$sInstall)
    Else
        MsgBox(0,"Error:","You have to select some software!")
    EndIf
EndFunc

While 1
    sleep(10)
WEnd

Share this post


Link to post
Share on other sites

To give you more information of what I'm trying to do. I own a small computer repair business and I currently have a main script(s) which runs all the individual install scripts. I think I have close to 60 different main scripts depending on the operating system and to where its 32 or 64 bit or if the computer has a DVD and needs codec software as well if I'm installing from a windows CD to a factory re-install. As you know the combination of what I need or may not need to install is many and I have to comment out on my main scripts what I don't want to install or un-comment what I do want to install which is a pain. That's why I would like a GUI to be able to pick a pre-defined package it automatically checks what software I want and to be able to add or remove software from the pre-defined package. The structure I currently have setup makes it easy for me to update. I intend to run these either from a flash drive or external hard drive. Below is just a partial main script for XPH that I use to run the actual scripts of each software, cleanup, services or tweaks that I use. I have 40 plus software install scripts and at least 60 cleanup scripts varying from OS to OS to 32-bit to 64-bit plus the services and tweak scripts.

#RequireAdmin

Opt("TrayIconDebug", 1)
Opt("SendKeyDelay", 200)
Opt("WinWaitDelay", 500)
Opt("WinTitleMatchMode", 2)

;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Program Installation
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Adobe Reader
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\ProgramFiles\AdobeReader\AdobeReader\AdobeReader.au3
    
; Adobe Reader Spelling Dictionary Pack Installation
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\ProgramFiles\AdobeReaderSpellingDictionaryPack\AdobeReaderSpellingDictionaryPack.au3"')

; Advanced System Care Installation
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\ProgramFiles\AdvancedSystemCare3\AdvancedSystemCare3.au3"')

; ATF Cleaner Installation
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\ProgramFiles\ATFCleaner\ATFCleaner.au3"')
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Program Cleanup
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

; Adobe Reader Cleanup
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\ProgramFiles\AdobeReader\AdobeReader_Cleanup.au3"')
    
; Advanced System Care Cleanup
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\ProgramFiles\AdvancedSystemCare3\AdvancedSystemCare3_Cleanup.au3"')
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Windows Cleanup
; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

; All Users Cleanup
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\SystemFiles\Cleanup\XP\XPEssentials_AllUsers_Cleanup.au3"')

; Current User Cleanup
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\SystemFiles\Cleanup\XP\XPEssentials_CurrentUser_Cleanup.au3"')

; All Users Tweaks
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\SystemFiles\Tweaks\XP\AllUsers.au3"')

; Current User Tweaks
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\SystemFiles\Tweaks\XP\CurrentUser.au3"')

; Services
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\SystemFiles\Services\XP\Home\WinXP_Home_32Bit.au3"')
;-----------------------------------------------------------------------------------------------------------------------------
MsgBox(64, "Done", "Installation Complete") ; It will let you know when the script is done

Exit

Since I am a newbie and trying to learn I may ask... what may seem to you to be a stupid question but I'm going to try and follow what you have done so far and comment.

You could hardcode these, or read em from an ini file

I'm game for whatever would be more particle or the easiest

Global $aSoftware_2K[4] = ["Adobe Reader 7.2","ATF","CCleaner","DVD Identifier"]

I'm assuming that the "[4]" refers to number of software included for that package?

It might be more practical detecting the OS automatically.

As you see what I was trying to do was over my head and auto detect would save a step

instead of a choice out of 3 GUI's we can just adjust one. This also allows you to add additional software packages and operating systems easily.

Well there will be more than 3 GUI's the route I was taking due to vista and 7 32 and 64 bit

I assumed you will always have exactly 2 package type options.

I just put in those 2 to figure out how to do it, same with the operating systems but when whatever package is selected, it checks the checkboxes

Any amount of software should work, but you may need to resize your GUI if there are allot.

Yes I understand this and the amount of scripts I have I was thinking that I would have to use tabs, one for software, one for cleanup (cleanup is just deleting icons from the desktop and organizing the start menu for example Security>Anti-Spyware>Spybot, Security>Anti-Virus>Avast, most of my customers are not very computer savvy so I organize things for them.

I don't know what the next step of installation is. Do you have seperate exe's for the installations, or functions?

I have a example above... all my scripts are .au3 and I think this would work and just compile when complete.

Thanks for your help!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I've got a few things to do atm, but I think I'm all free after that to think this over a bit more and come back with some suggestions.

Edit:

I'm assuming that the "[4]" refers to number of software included for that package?

Yes I chose 4, because I wanted to store 4 application names.

It creates an array with 4 indices. Each index can hold anything a normal variable can hold.

The great thing about them is that you can resize them and loop through them and it cuts down on the amount of variable names you have to come up with.

As you see what I was trying to do was over my head and auto detect would save a step

Perhaps best to first get the basics working first. The OS detection functionality is easily tagged on afterwards.

Well there will be more than 3 GUI's the route I was taking due to vista and 7 32 and 64 bit

Even better: Windows 7, Vista and XP alone have like 30 different editions between them and creating a GUI for each one would be painfull. (You will have to write a ini file for most, but I suspect that you can copy/paste a lot)

Here is just one way I can see this work. It requires one ini file for each windows version. Each ini file should contain the sections "Packs", "Apps" and "CleanUp".

I've modified your script quite a bit, so see which parts you like and discard the rest. If anything is unclear just ask.

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIoneventmode", 1)
Opt('MustDeclareVars', 1)

Global $CtrlCombo, $CtrlButton, $CtrlTab

Global $sIniPath = @ScriptDir & "\WindowsVersions\" ;This will be where the application looks for the ini files that specify the applications for each OS.
Global $aPacks, $aApps, $aCleanUp ;These arrays will hold the contents of the inifile for the OS specified in the Combo control.

Global $sVersions = _FileListToString($sIniPath,"*.ini") ;All the ini files in that folder are read and put in the combo.
If @error Then
    MsgBox(48,"Error!","No ini files found in:" & @CRLF & $sIniPath)
    Exit
EndIf

;The main GUI
GUICreate("Software Installation Wizard", 630, 370)
GUISetOnEvent(-3,"_Exit")
GUICtrlCreateLabel("Please Select your Operating System.", 190, 10, 180, 20)
$CtrlCombo = GUICtrlCreateCombo("Please Select" , 375, 8, 252, 20)
GUICtrlSetData($CtrlCombo, $sVersions)
GUICtrlSetOnEvent($CtrlCombo,"_SetVersion")
$CtrlButton = GUICtrlCreateButton("Continue ->",507,342,120,25)
GUICtrlSetOnEvent($CtrlButton,"_Install")
GUICtrlSetState($CtrlButton,$GUI_DISABLE)
GUISetState()

While 1
    sleep(10)
WEnd

;Create a Tab control with the relevant checkboxes for the selected OS.
Func _SetVersion()
    Local $sOpSys, $CtrlTabItem1
    If $CtrlTab Then
        GUICtrlDelete($CtrlTab)
        $CtrlTab = False
    EndIf

    GUICtrlSetState($CtrlButton,$GUI_ENABLE)

    $sOpSys = GUICtrlRead($CtrlCombo)
    If $sOpSys = "Please Select" Then
        GUICtrlSetState($CtrlButton,$GUI_DISABLE)
        Return
    EndIf

    $CtrlTab = GUICtrlCreateTab(2,10,627,330)
    $CtrlTabItem1 = GUICtrlCreateTabItem ( "Packs" )
    $aPacks = IniReadSection($sIniPath & $sOpSys,"Packs")
    If IsArray($aPacks) Then
        For $i = 1 To $aPacks[0][0]
            ;I am replacing the application name, with the Ctrl ID of the checkbox that gets that name here. You could also add a column to hold the Id, or create a seperate array for them with matching indices. This seemed most effecient to me.
            $aPacks[$i][0] = GUICtrlCreateCheckbox($aPacks[$i][0],10,20+$i*22)
        Next
    EndIf

    GUICtrlCreateTabItem ( "Applications" )
    $aApps = IniReadSection($sIniPath & $sOpSys,"Apps")
    If IsArray($aApps) Then
        For $i = 1 To $aApps[0][0]
            $aApps[$i][0] = GUICtrlCreateCheckbox($aApps[$i][0],10,20+$i*22)
        Next
    EndIf

    GUICtrlCreateTabItem ( "CleanUp")
    $aCleanUp = IniReadSection($sIniPath & $sOpSys,"CleanUp")
    If IsArray($aCleanUp) Then
        For $i = 1 To $aCleanUp[0][0]
            $aCleanUp[$i][0] = GUICtrlCreateCheckbox($aCleanUp[$i][0],10,20+$i*22)
        Next
    EndIf

    GUICtrlCreateTabItem ( "")
    GUICtrlSetState($CtrlTabItem1,$GUI_SHOW)
EndFunc

;Reads which checkboxes are checked and runs the script they specify.
;RunWaits are commented out for testing
;Make sure you have the paths to the *.au3 files correct before uncommenting the RunWaits.
Func _Install()
    If IsArray($aPacks) Then
        For $i = 1 To $aPacks[0][0]
            If GUICtrlRead($aPacks[$i][0]) = 1 Then
                ConsoleWrite($aPacks[$i][1] & @CRLF)
                If FileExists(@ScriptDir & $aPacks[$i][1]) Then
;~                  RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & $aPacks[$i][1] & '"')
                Else
                    ConsoleWrite("File: " & @ScriptDir & $aPacks[$i][1] & " does not exist" & @CRLF)
                EndIf
            EndIf
        Next
    EndIf
    If IsArray($aApps) Then
        For $i = 1 To $aApps[0][0]
            If GUICtrlRead($aApps[$i][0]) = 1 Then
                ConsoleWrite($aApps[$i][1] & @CRLF)
                If FileExists(@ScriptDir & $aApps[$i][1]) Then
;~                  RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & $aApps[$i][1] & '"')
                Else
                    ConsoleWrite("File: " & @ScriptDir & $aApps[$i][1] & " does not exist" & @CRLF)
                EndIf
            EndIf
        Next
    EndIf
    If IsArray($aCleanUp) Then
        For $i = 1 To $aCleanUp[0][0]
            If GUICtrlRead($aCleanUp[$i][0]) = 1 Then
                ConsoleWrite($aCleanUp[$i][1] & @CRLF)
                If FileExists(@ScriptDir & $aCleanUp[$i][1]) Then
;~                  RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & $aCleanUp[$i][1] & '"')
                Else
                    ConsoleWrite("File: " & @ScriptDir & $aCleanUp[$i][1] & " does not exist" & @CRLF)
                EndIf
            EndIf
        Next
    EndIf
EndFunc

;I took FileListToArray from file.au3 and removed the stringsplit at the end.
Func _FileListToString($sPath, $sFilter = "*", $iFlag = 0)
    Local $hSearch, $sFile, $sFileList, $sDelim = "|"
    $sPath = StringRegExpReplace($sPath, "[\\/]+\z", "") & "\" ; ensure single trailing backslash
    If Not FileExists($sPath) Then Return SetError(1, 1, "")
    If StringRegExp($sFilter, "[\\/:><\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "")
    If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "")
    $hSearch = FileFindFirstFile($sPath & $sFilter)
    If @error Then Return SetError(4, 4, "")
    While 1
        $sFile = FileFindNextFile($hSearch)
        If @error Then ExitLoop
        If ($iFlag + @extended = 2) Then ContinueLoop
        $sFileList &= $sDelim & $sFile
    WEnd
    FileClose($hSearch)
    If Not $sFileList Then Return SetError(4, 4, "")
    Return StringTrimLeft($sFileList, 1)
EndFunc

Func _Exit()
    If MsgBox(262452,"Cancel","Are you sure you want to exit?") = 6 Then Exit
EndFunc

Here is an example file I put at

@ScriptDir & "\WindowsVersions\XP Professional 32-Bits.ini"

I made up some of the paths, but it shows the layout of the files nicely.

[Packs]
Home Basic = \ProgramFiles\Packs\XPProHomeBasic.au3
Home Security = \ProgramFiles\Packs\XPProHomeSecureity.au3
[Apps]
Adobe Reader = \ProgramFiles\AdobeReader\AdobeReader\AdobeReader.au3
ATF Cleaner = \ProgramFiles\ATFCleaner\ATFCleaner.au3
Advanced System Care = \ProgramFiles\AdvancedSystemCare3\AdvancedSystemCare3.au3
[CleanUp]
Adobe Reader = \ProgramFiles\AdobeReader\AdobeReader_Cleanup.au3
Advanced System Care = \ProgramFiles\AdvancedSystemCare3\AdvancedSystemCare3_Cleanup.au3
All Users = \SystemFiles\Cleanup\XP\XPEssentials_AllUsers_Cleanup.au3
Edited by Tvern

Share this post


Link to post
Share on other sites

waste of time to make installation wizards with autoit, in thise case wise package studio is much much better.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

waste of time to make installation wizards with autoit, in thise case wise package studio is much much better.

Thanks for your reply and the information on Wise Package Studio and as I briefly checked it out, I did not install the trial version. Since you use this program could you answer a question, can this program install Firefox with my choice of Plugins and configure what settings I have in the script below? No offense intended but as to being "a waste of time" I am learning autoit! Since I understand the purpose of this script, it's helping me understand how to put things together and that's something that I just can't or am not getting from just trying to use the help files.

#RequireAdmin

Opt("TrayIconDebug", 1)
Opt("WinWaitDelay", 500)
Opt("WinTitleMatchMode", 3)

;-----------------------------------------------------------------------------------------------------------------------------
; Mozilla Firefox 32-Bit Installation
;-----------------------------------------------------------------------------------------------------------------------------

$a = "Import Wizard"
$b = "Default Browser"
$c = "Welcome to Firefox - Mozilla Firefox"
$d = "Mozilla Firefox Start Page - Mozilla Firefox"
$e = "Options"
$f = "Software Installation"

; Install Firefox
RunWait(@ScriptDir & '\Firefox Setup 3.6.12.exe -ms')
; Start Firefox for first run
RunWait('C:\Program Files\Mozilla Firefox\firefox.exe')
; Set Import Wixard - Do Not Import anything from IE
WinWait($a,"")
If Not WinActive($a,"") Then WinActivate($a,"")
Send("{DOWN}{TAB}{ENTER}")
; Set Default Browser to Firefox
WinWait($b,"")
If Not WinActive($b,"") Then WinActivate($b,"")
Send("{TAB 3}{SPACE}{ENTER}")
WinWait($c,"")
If Not WinActive($c,"") Then WinActivate($c,"")    
; Quit Firefox to remove Firefox the First Run
ProcessClose("firefox.exe")
SLEEP(5000)
; Set Downloads to "Always ask where to save download files to
Run('C:\Program Files\Mozilla Firefox\firefox.exe')
WinWait($d,"")
If Not WinActive($d,"") Then WinActivate($d,"")
Send("{ALT}{RIGHT 5}{UP 2}{ENTER}")
; Set Options
WinWait($e,"")
If Not WinActive($e,"") Then WinActivate($e,"")
Send("{TAB 8}{DOWN}{TAB 2}{ENTER}")
Send("{ALT}{UP 2}{ENTER}")
ProcessClose("firefox.exe")
SLEEP(5000)
;Restart Firefox and Install Plugins
Run('C:\Program Files\Mozilla Firefox\firefox.exe')
WinWaitActive($d, "")
; 1-Click Weather
Send("{ALT}{DOWN 3}{ENTER}")
SLEEP(500) ; A little delay - had problems where it was messing up and typing in wrong place
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/1035/addon-1035-latest.xpi")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100) ; Delay to allow "Install" button to become active
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500) ; Delay to allow for downloading of plugin - adjust to suit your internet connection speed - 15000 for Hughesnet 7500 for Office
; Adblock Plus
WinActivate($d, "")
Send("{ALT}{DOWN 3}{ENTER}")
SLEEP(500)
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/1865/addon-1865-latest.xpi")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100)
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500)
; Colorful Tabs
WinActivate($d, "")
Send("{ALT}{DOWN 3}{ENTER}")
SLEEP(500)
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/1368/addon-1368-latest.xpi")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100)
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500)
; Download Statusbar
WinActivate($d, "")
Send("{ALT}{DOWN 3}{ENTER}")
SLEEP(500)
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/26/addon-26-latest.xpi")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100)
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500)
; IE Tab
WinActivate($d, "")
Send("{ALT}{DOWN 3}{ENTER}")
SLEEP(500)
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/10909/platform:5/addon-10909-latest.xpi?src=addondetail")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100)
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500)
; NoSquint
WinActivate($d, "")
Send("{ALT}{DOWN 3}{ENTER}") 
SLEEP(500)
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/2592/addon-2592-latest.xpi")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100)
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500)
; NoScript
WinActivate($d, "")
Send("{ALT}{DOWN 3}{ENTER}")
SLEEP(500)
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/722/addon-722-latest.xpi")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100)
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500)
; Tab Mix Plus
WinActivate($d, "")
Send("{ALT}{DOWN 3}{ENTER}")
SLEEP(500)
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/1122/addon-1122-latest.xpi")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100)
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500)
; Toolbar Buttons
WinActivate($d, "")
Send("{ALT}{DOWN 3}{ENTER}")
SLEEP(500)
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/2377/addon-2377-latest.xpi")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100)
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500)
; Web Of Trust (WOT)
WinActivate($d, "")
Send("{ALT}{DOWN 3}{ENTER}")
SLEEP(500)
Send("https://addons.mozilla.org/en-US/firefox/downloads/latest/3456/addon-3456-latest.xpi")
Send("{ENTER}")
WinWaitActive($f,"")
SLEEP(1100)
Send("{TAB 2}")
SLEEP(500)
Send("{ENTER}")
SLEEP(7500)
; Close Firefox
ProcessClose("firefox.exe")
TrayTip('Mozilla Firefox 32-Bit Installation', 'This Dirty Deed Has Been Completed', 5)
Sleep(2000) 
Exit

@ Tvern

Sorry for the delay in replying back but I've been busy working on computers by day and by night writing my .ini files and rewriting some of my main and install scripts and trying to evaluate how this script works.

BTW I love the comments that you're putting in and although some of this is coming together for me there's still some in the script that just goes right over my head.

The script is working on the Packages anyways and the only issue I'm having is on the .ini files, well they are working great except in the GUI like in App's where I have a large number of entries, its just making a list of one column and I've tried to do some research but can't find any way to make a .ini file break the data up in columns.

So Far, array's are making since and if you look in the Firefox script above you can see I've made good use of them... saves a lot of time typing too! I also started using the IF statement and have shortened some of my Security scripts for example Windows Defender is not installed by default for XP to where its installed in Vista and 7 by default (although my not be turned on). If you have time and don't mind can you look over the Firefox and the Windows Defender and let me know if I'm doing these correctly or is there a better way to code these.

#RequireAdmin

Opt("TrayIconDebug", 1)

; ----------------------------------------------------------------------------
; Windows Defender 32-Bit Installation 
; ----------------------------------------------------------------------------

If FileExists(@ProgramFilesDir & "\Windows Defender\MSASCui.exe") Then Exit
If Not FileExists(@ProgramFilesDir & "\Windows Defender\MSASCui.exe") Then
ShellExecuteWait(@ScriptDir & '\WindowsDefender.msi', ' /qn')
EndIf

TrayTip('Windows Defender 32-Bit Installation', 'This Dirty Deed Has Been Completed', 5)
Sleep(2000)
Exit

Thanks again for all of your help!

Edited by pcjames

Share this post


Link to post
Share on other sites

yea wise package studio can do that :x it generates a msi package, and you can even makes switches like this:

/QB!, example: "C:\Users\pc\Desktop\program.msi" /QB!

that would install the program without asking any question, if you want it totally silen do: /S.

example steam "the game client" is a msi package :P.

You will have watch a little torturial to understand wise, it's very easy to use, but you have to know what you do, like cleaning up the msi package.

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