Jump to content

The Vollatran Project - Application Installer tool


Bert
 Share

Recommended Posts

As of May 12th, 2020 - I no longer do much coding at all. If you have any questions about this software please post your questions in the main support forum.

The Vollatran Project - Application Installer tool

I've been running a PM thread for a while for a script that performs batch type application installs on PCs. I'm not the original author of the script (My hat goes off to Kennedy for the original work!) but I have taken his wonderful work and tweaked it to my needs.

Screenshot example:

post-7428-0-95364500-1317749860_thumb.jp

Version of AutoIt required: 3.3.6.1. (or later)

Main Script:

;Notes: I'm not the original writer of this code. I have taken the code and made changes to it to suit
;my purposes as well as maintaining it. The original writer is Kennedy.
#include <file.au3>
Opt("ExpandEnvStrings", 1) ;test
Opt("TrayIconDebug", 1)
Dim $Ver ;OS Version
Dim $OS ;OS Version in more readable format
ReturnOSVersion()
_inicheck() ;if the INI for the OS is missing the script will error then exit
Dim $InstallFile = @ScriptDir & "\config\" & $Ver & ".ini" ;default install file
Dim $LogFile = IniRead(@ScriptDir & "\config\config.ini", "config", "LogFilePath", @TempDir) & "\Install_History\Install-" & @ComputerName & ".txt"
Dim $Log = IniRead(@ScriptDir & "\config\config.ini", "config", "LogFile", "1")
Dim $settings = "\config\config.ini"
Dim $AvailableArray[1][1] ;array with all commands
Dim $SelectedArray[1][1] ;array with commands to run
Dim $Available ;list with all sections
Dim $Selected ;list with selected sections
Dim $DefaultProfile = "(none)" ;profile selected by default
Dim $ProfilesList = "" ;list of all profiles
Dim $SelectedProfile = "" ;currently selected profile
Dim $Profile = "" ;profile to use in silent run
Dim $Silent = 0 ;is it silent run?
Dim $ForceGUI = 0 ;show GUI for non-standart file?
Dim $Reboot = 1 ;reboot mode
Dim $AutoLogon = 0 ;autologon selected?
Dim $RebootCount = 0 ;number of reboots required
Dim $Flag ;default flag for installation
If IniRead(@ScriptDir & "\config\config.ini", "config", "WindowMode", "Minimize") = "Minimize" Then $Flag = @SW_MINIMIZE
If IniRead(@ScriptDir & "\config\config.ini", "config", "WindowMode", "Minimize") = "Maximize" Then $Flag = @SW_MAXIMIZE
If IniRead(@ScriptDir & "\config\config.ini", "config", "WindowMode", "Minimize") = "Hide" Then $Flag = @SW_HIDE
Dim $NonSelectable = IniRead(@ScriptDir & "\config\config.ini", "config", "NonSelectable", "")
Dim $RebootTimer = IniRead(@ScriptDir & "\config\config.ini", "config", "RebootTimer", "60")
Dim $AdminWarning = IniRead(@ScriptDir & "\config\config.ini", "config", "AdminWarning", "1")
Dim $ProgressType = IniRead(@ScriptDir & "\config\config.ini", "config", "ProgressType", "2")
Dim $Logging = IniRead(@ScriptDir & "\config\config.ini", "config", "Logging", "1")
Dim $Append = "" ;path to append to commands
 
Dim $Description ;description for Progress2 items
Dim $Context ;context for Progress2
Dim $SoftwareToInstall = 0
Dim $Subcommands = 0
Dim $CurrentSubCommand = 0
Dim $LabelDescription, $ProgressSubItems, $ProgressItem1, $ProgressItem2
;;;;;;;;;;;;;
;MAIN
If $AdminWarning = 1 Then CheckAdmin()
CommandLine()
FileToArray($AvailableArray, $InstallFile)
If $Silent = 1 And $ForceGUI = 0 Then
If $Profile <> "" Then
  $Selected = IniRead($InstallFile, "Profiles", $Profile, "")
Else
  $Selected = $Available
EndIf
Else
ReturnOSVersion()
GUI()
GUIDelete()
EndIf
ReadSelection()
Install()
GUIDelete()
If $Reboot > 1 Then Reboot($RebootTimer)
;;;;;;;;;;;;;
;done
Func ReturnOSVersion() ;Get OS version to readable format
$Ver = @OSVersion
Select
  Case $Ver = "WIN_7"
   If @OSArch = "X86" then
    $Ver = "WIN_7_32"
    $OS = "Windows 7 - 32Bit  "
   EndIf
   If @OSArch = "X64" then
    $Ver = "WIN_7_64"
    $OS = "Windows 7 - 64Bit  "
   EndIf
  Case $Ver = "WIN_2008R2"
   $OS = "Windows Server 2008"
  Case $Ver = "WIN_VISTA"
   $OS = "Windows Vista"
  Case $Ver = "WIN_2003"
   $OS = "Windows Server 2003"
  Case $Ver = "WIN_XP"
   If @OSArch = "X86" then
    $Ver = "WIN_XP_32"
    $OS = "Windows XP - 32Bit  "
   EndIf
   If @OSArch = "X64" then
    $Ver = "WIN_XP_64"
    $OS = "Windows XP - 64Bit  "
   EndIf
  Case $Ver = "WIN_2000"
   $OS = "Windows 2000"
  Case $Ver = "WIN_98"
   $OS = "Windows 98"
  Case $Ver = "WIN_ME"
   $OS = "Windows ME"
  Case $Ver = "WIN_95"
   $OS = "Windows 95"
  Case $Ver = "WIN_NT4"
   $OS = "Windows NT4"
EndSelect
EndFunc   ;==>ReturnOSVersion
;done
Func CommandLine() ; Read command line options
For $i = 1 To UBound($CmdLine) - 1
  Select
   Case $CmdLine[$i] = "?" Or $CmdLine[$i] = "/?" Or $CmdLine[$i] = "help" Or $CmdLine[$i] = "/help"
    MsgBox(0, "Help", "/? - Displays this message" & @LF & _
      "filename     - Specify file to read instructions from (Silent mode)" & @LF & _
      "                     You can create such files in GUI mode" & @LF & _
      "/GUI              Forces GUI mode" & @LF & _
      "Profile             Profile to use" & @LF & _
      "reboot            0 - Disable restarting the computer" & @LF & _
      "                     1 - Enable restarting the computer (default)" & @LF & _
      "                     2 - Disable but restart when finished" & @LF & _
      "                     3 - Enable and restart when finished" & @LF & @LF & _
      "Example:" & @LF & _
      "   VollatranInstall.exe c:\VollatranInstall.ini 2")
    Exit
   Case StringIsDigit($CmdLine[$i])
    Select
     Case $CmdLine[$i] = 0
      $Reboot = 0
     Case $CmdLine[$i] = 1
      $Reboot = 1
     Case $CmdLine[$i] = 2
      $Reboot = 2
     Case $CmdLine[$i] = 3
      $Reboot = 3
    EndSelect
   Case $CmdLine[$i] = "/GUI"
    $ForceGUI = 1
   Case StringRight($CmdLine[$i], 4) = ".ini"
    $InstallFile = $CmdLine[$i]
    $Silent = 1
   Case Else
    $Profile = $CmdLine[$i]
  EndSelect
Next
EndFunc   ;==>CommandLine
;done
Func Reboot($tSeconds) ;Reboot computer
ProgressOn("Restarting", IniRead(@ScriptDir & "\config\config.ini", "Language", "Restarting", "Restarting"), "", -1, -1, 16)
For $i = $tSeconds To 0 Step -1
  Sleep(1000)
  ProgressSet((($tSeconds - $i) * 100) / $tSeconds, $i & " seconds")
Next
Shutdown(6)
EndFunc   ;==>Reboot
;done
Func CheckAdmin() ;Check if user has administrator rights
If IsAdmin() = 0 Then
  If MsgBox(4, "", "Administrator rights required. Continue?") = 7 Then Exit
EndIf
EndFunc   ;==>CheckAdmin
;done
Func FileToArray(ByRef $tArray, $tFile) ;Write all commands to array
$i = 0
$ProfilesList = IniRead($tFile, "Config", "Profiles", "")
$ProfilesList = $ProfilesList & "|All|(none)"
$DefaultProfile = IniRead($tFile, "Config", "DefaultProfile", "(none)")
$Append = IniRead($tFile, "Config", "Append", "")
If $Append = "CD" Then $Append = @ScriptDir & "\"
$tOpenFile = FileOpen($tFile, 0)
While 1
  $tLine = FileReadLine($tOpenFile)
  If @error = -1 Then ExitLoop
  $tLine = StringStripWS($tLine, 3)
  Select
   Case StringLeft($tLine, 1) = "["
    If StringLeft($tLine, 8) <> "[Config]" And StringLeft($tLine, 10) <> "[Profiles]" Then
     FillArray($tArray, $tLine, "Section", $i)
     $tArray[$i - 1][0] = StringReplace($tArray[$i - 1][0], "[", "")
     $tArray[$i - 1][0] = StringReplace($tArray[$i - 1][0], "]", "")
     $Available = $Available & "|" & $tArray[$i - 1][0]
    EndIf
   Case StringLeft($tLine, 7) = "RunWait"
    FillArray($tArray, $tLine, "RunWait", $i)
   Case StringLeft($tLine, 3) = "Run"
    FillArray($tArray, $tLine, "Run", $i)
   Case StringLeft($tLine, 3) = "MSI"
    FillArray($tArray, $tLine, "MSI", $i)
   Case StringLeft($tLine, 3) = "DOS"
    FillArray($tArray, $tLine, "DOS", $i)
   Case StringLeft($tLine, 3) = "REG"
    FillArray($tArray, $tLine, "REG", $i)
   Case StringLeft($tLine, 11) = "WaitProcess"
    FillArray($tArray, $tLine, "WaitProcess", $i)
   Case StringLeft($tLine, 12) = "WinWaitClose"
    FillArray($tArray, $tLine, "WinWaitClose", $i)
   Case StringLeft($tLine, 6) = "Reboot"
    FillArray($tArray, $tLine, "Reboot", $i)
   Case StringLeft($tLine, 13) = "FolderCommand"
    FillArray($tArray, $tLine, "FolderCommand", $i)
   Case StringLeft($tLine, 11) = "FolderFiles"
    FillArray($tArray, $tLine, "FolderFiles", $i)
   Case StringLeft($tLine, 12) = "FolderSwitch"
    FillArray($tArray, $tLine, "FolderSwitch", $i)
   Case StringLeft($tLine, 6) = "Folder"
    FillArray($tArray, $tLine, "Folder", $i)
   Case StringLeft($tLine, 16) = "FileExistVersion"
    FillArray($tArray, $tLine, "FileExistVersion", $i)
   Case StringLeft($tLine, 15) = "FileExistAction"
    FillArray($tArray, $tLine, "FileExistAction", $i)
   Case StringLeft($tLine, 9) = "FileExist"
    FillArray($tArray, $tLine, "FileExist", $i)
   Case StringLeft($tLine, 18) = "FileNotExistAction"
    FillArray($tArray, $tLine, "FileNotExistAction", $i)
   Case StringLeft($tLine, 12) = "FileNotExist"
    FillArray($tArray, $tLine, "FileNotExist", $i)
   Case StringLeft($tLine, 11) = "Description"
    FillArray($tArray, $tLine, "Description", $i)
   Case StringLeft($tLine, 7) = "Context"
    FillArray($tArray, $tLine, "Context", $i)
   Case Else
  EndSelect
WEnd
FileClose($tOpenFile)
EndFunc   ;==>FileToArray
;done
Func FillArray(ByRef $tArray, $tLine, $tCommand, ByRef $tCounter)
ReDim $tArray[$tCounter + 1][2]
$tPos = StringInStr($tLine, "=")
$tLine = StringTrimLeft($tLine, $tPos)
$tLine = StringStripWS($tLine, 3)
$tArray[$tCounter][0] = $tLine
$tArray[$tCounter][1] = $tCommand
$tCounter = $tCounter + 1
EndFunc   ;==>FillArray
;done
Func DelFromList(ByRef $tList, $tItem)
$tList = StringReplace($tList & "|", "|" & $tItem & "|", "|")
$tList = StringTrimRight($tList, 1)
EndFunc   ;==>DelFromList
;done
Func CheckList($tString, $tSubstring) ; Check if substring is in the list
$tString = $tString & "|"
If StringInStr($tString, "|" & $tSubstring & "|") > 0 Then
  Return 1
Else
  Return 0
EndIf
EndFunc   ;==>CheckList
;done
Func ReadSelection()
$tSelected = ""
$Subcommands = 0
$SoftwareToInstall = 0
$tNumber = UBound($AvailableArray)
$j = 1
$tTriger = 0
For $i = 0 To $tNumber - 1
  If $AvailableArray[$i][1] = "Section" Then
   If CheckList($Selected, $AvailableArray[$i][0]) = 1 Then
    $SoftwareToInstall = $SoftwareToInstall + 1
    $tTriger = 1
    $tSelected = $tSelected & "|" & $AvailableArray[$i][0]
   Else
    $tTriger = 0
   EndIf
  EndIf
  If $tTriger = 1 Then
   ReDim $SelectedArray[$j][2]
   $SelectedArray[$j - 1][0] = $AvailableArray[$i][0]
   $SelectedArray[$j - 1][1] = $AvailableArray[$i][1]
   If $AvailableArray[$i][1] = "Reboot" Then $RebootCount = $RebootCount + 1
   $j = $j + 1
  EndIf
Next
$Selected = $tSelected
EndFunc   ;==>ReadSelection
;done
Func FindNextSection($tArray, $tCounter)
For $i = $tCounter To UBound($tArray) - 1
  If $tArray[$i][1] = "Section" Then Return $i
Next
Return -1
EndFunc   ;==>FindNextSection
;done
Func CountFiles($tFolder, $tFileType)
$i = 0
$tFile = FileFindFirstFile($tFolder & "\*." & $tFileType)
If $tFile = -1 Then
  Return 0
EndIf
While 1
  $tNextFile = FileFindNextFile($tFile)
  If @error Then Return $i
  $i = $i + 1
WEnd
EndFunc   ;==>CountFiles
;done
Func GUI()
$gui1 = GUICreate("Vollatran - " & $OS & " " & @OSServicePack, 510, 455)
GUICtrlCreateTab(0, 0, 510, 455)
GUICtrlCreateTabItem("Available Software")
GUICtrlCreateLabel(IniRead(@ScriptDir & "\config\config.ini", "Language", "Available", "Available Programs"), 20, 30, 160, 20)
GUICtrlSetFont(-1, 12, 646)
GUICtrlCreateLabel(IniRead(@ScriptDir & "\config\config.ini", "Language", "Selected", "Selected Programs"), 210, 30, 160, 20)
GUICtrlSetFont(-1, 12, 646)
GUICtrlCreateLabel(@YEAR&" VP", 390, 420, 160, 20)
$ListAvailable = GUICtrlCreateList("", 10, 50, 180, 400, 0x00a00001)
GUICtrlSetData(-1, $Available)
GUICtrlSetTip(-1, "Click on item to select it")
$ListSelected = GUICtrlCreateList("", 200, 50, 180, 400, 0x00a00001)
$Selected = IniRead($InstallFile, "Profiles", $DefaultProfile, "")
GUICtrlSetData(-1, $Selected)
GUICtrlSetTip(-1, "Click on item to remove it")
$ButtonStart = GUICtrlCreateButton(IniRead(@ScriptDir & "\config\config.ini", "Language", "Start", "Start"), 390, 380, 110, 25, 0x0001)
GUICtrlSetTip(-1, "Start Installation")
$ComboProfiles = GUICtrlCreateCombo("", 390, 50, 110, 30, 0x00200142)
GUICtrlSetData(-1, $ProfilesList, $DefaultProfile)
GUICtrlSetTip(-1, "Select Profile to use")
$ButtonSaveProf = GUICtrlCreateButton(IniRead(@ScriptDir & "\config\config.ini", "Language", "SaveProfile", "Save Profile"), 390, 80, 110, 25)
GUICtrlSetTip(-1, "Save/Update selected profile")
$ButtonDelProf = GUICtrlCreateButton(IniRead(@ScriptDir & "\config\config.ini", "Language", "DeleteProfile", "Delete Profile"), 390, 110, 110, 25)
GUICtrlSetTip(-1, "Delete selected profile")
$ButtonClear = GUICtrlCreateButton(IniRead(@ScriptDir & "\config\config.ini", "Language", "Clear", "Clear"), 390, 140, 110, 25)
GUICtrlSetTip(-1, "Remove all selected items from list")
$CheckReboot = GUICtrlCreateCheckbox(IniRead(@ScriptDir & "\config\config.ini", "Language", "Reboot", "Reboot"), 410, 305, 90, 20)
GUICtrlSetTip(-1, "Reboot when finished")
$CheckAutoLog = GUICtrlCreateCheckbox(IniRead(@ScriptDir & "\config\config.ini", "Language", "Autologon", "Autologon"), 410, 325, 90, 20)
GUICtrlSetTip(-1, "Enable autologon")
$ButtonSaveFile = GUICtrlCreateButton(IniRead(@ScriptDir & "\config\config.ini", "Language", "SaveToFile", "Save To File"), 390, 350, 110, 25)
GUICtrlSetTip(-1, "Save selection to file")
$logo1 = IniRead(@ScriptDir & $settings, "logo", "pic1", "")
$logo2 = IniRead(@ScriptDir & $settings, "logo", "pic2", "")
If $logo1 = "" Then
  ConsoleWrite('line: '&@ScriptLineNumber & ':'&@crlf&'GUICtrlCreatePic(@ScriptDir & $logo1, 390, 170, 110, 60) = You will need to insert pic to make it apppear'&@crlf) ;### Debug Console
  GUICtrlCreateLabel("No Logo defined. Edit config.ini> [logo]> pic1 to add logo", 390, 170, 110, 60)
Else
  GUICtrlCreatePic(@ScriptDir & $logo1, 390, 170, 110, 60)
EndIf
If $logo2 = "" Then
  ConsoleWrite('line: '&@ScriptLineNumber & ':'&@crlf&'GUICtrlCreatePic(@ScriptDir & $logo2, 390, 240, 110, 60) = You will need to insert pic to make it apppear'&@crlf) ;### Debug Console
     GUICtrlCreateLabel("No Logo defined. Edit config.ini> [logo]> pic2 to add logo", 390, 240, 110, 60)
Else
  GUICtrlCreatePic(@ScriptDir & $logo2, 390, 240, 110, 60)
EndIf
;~  GUICtrlCreateTabItem("Currently Installed Software")
;~  ;Will use Big_daddy's code here to build section
;~
;~  GUICtrlCreateTabItem("System Information")
;~  ;will need to research
;~
;~  GUICtrlCreateTabItem("Log files")
;~  ;All logs will be here. Have buttons to open new child windows.
;~
;~  GUICtrlCreateTabItem("Settings")
;~  ;All settings that are contained in config file will be controled here.
;~  ;
GUISetState(@SW_SHOW, $gui1)
While 1
  $msg = GUIGetMsg()
  Select
   Case $msg = -3
    Exit
   Case $msg = $ListAvailable
    $tItem = GUICtrlRead($ListAvailable)
    If $tItem <> "" And StringLeft($tItem, 1) <> $NonSelectable Then
     If CheckList($Selected, $tItem) = 0 Then
      $Selected = $Selected & "|" & $tItem
      GUICtrlSetData($ListSelected, $Selected)
     EndIf
    EndIf
   Case $msg = $ListSelected
    $tItem = GUICtrlRead($ListSelected)
    If $tItem <> "" Then
     $tString = $Selected & "|"
     $tString = StringReplace($tString, "|" & $tItem & "|", "|")
     $Selected = StringTrimRight($tString, 1)
     GUICtrlSetData($ListSelected, $Selected)
    EndIf
   Case $msg = $ButtonStart
    ExitLoop
   Case $msg = $ComboProfiles
    $SelectedProfile = GUICtrlRead($ComboProfiles)
    Select
     Case $SelectedProfile = "(none)"
      $Selected = ""
      GUICtrlSetData($ListSelected, $Selected)
     Case $SelectedProfile = "All"
      $Selected = ""
      $tArray = StringSplit($Available, "|")
      For $i = 1 To $tArray[0]
       If $tArray[$i] <> "" And StringLeft($tArray[$i], 1) <> $NonSelectable Then
        $Selected = $Selected & "|" & $tArray[$i]
       EndIf
      Next
      GUICtrlSetData($ListSelected, $Selected)
     Case Else
      $Selected = IniRead($InstallFile, "Profiles", $SelectedProfile, "")
      GUICtrlSetData($ListSelected, $Selected)
    EndSelect
   Case $msg = $ButtonSaveProf
    $tItem = GUICtrlRead($ComboProfiles)
    If StringIsDigit($tItem) = 1 Then
     MsgBox(0, "", "Profile name can't be a number")
     ContinueLoop
    EndIf
    If $tItem <> "(none)" And $tItem <> "All" And StringStripWS($tItem, 3) <> "" Then
     If CheckList($ProfilesList, $tItem) = 0 Then
      $ProfilesList = $ProfilesList & "|" & $tItem
      $tString = $ProfilesList
      DelFromList($tString, "(none)")
      DelFromList($tString, "All")
      IniWrite($InstallFile, "Config", "Profiles", $tString)
     EndIf
     IniWrite($InstallFile, "Profiles", $tItem, $Selected)
     GUICtrlSetData($ComboProfiles, "")
     GUICtrlSetData($ComboProfiles, $ProfilesList, $tItem)
    EndIf
   Case $msg = $ButtonDelProf
    $tItem = GUICtrlRead($ComboProfiles)
    If $tItem <> "(none)" And $tItem <> "All" And StringStripWS($tItem, 3) <> "" Then
     DelFromList($ProfilesList, $tItem)
     $tString = $ProfilesList
     DelFromList($tString, "(none)")
     DelFromList($tString, "All")
     IniWrite($InstallFile, "Config", "Profiles", $tString)
     IniDelete($InstallFile, "Profiles", $tItem)
     GUICtrlSetData($ComboProfiles, "")
     GUICtrlSetData($ComboProfiles, $ProfilesList)
    EndIf
   Case $msg = $ButtonClear
    $Selected = ""
    GUICtrlSetData($ListSelected, $Selected)
   Case $msg = $CheckReboot
    If $Reboot < 2 Then
     $Reboot = $Reboot + 2
    ElseIf $Reboot > 1 Then
     $Reboot = $Reboot - 2
    EndIf
   Case $msg = $CheckAutoLog
    If $AutoLogon = 0 Then
     $AutoLogon = 1
    ElseIf $AutoLogon = 1 Then
     $AutoLogon = 0
    EndIf
   Case $msg = $ButtonSaveFile
    ReadSelection()
    GUICtrlSetData($ListSelected, $Selected)
    SaveToFile("", 0)
   Case Else
  EndSelect
WEnd
EndFunc   ;==>GUI
;win other
Func AutoLogon() ;Write autologon information to registry
If $Ver = "WIN_XP_32" Or $Ver = "WIN_XP_64" Or $Ver = "WIN_2000" Or $Ver = "WIN_NT4" Then
  ; -------------------------------------------------------------------------------------------------------
; Note - I added support for 32 bit and 64 bit Windows XP. However I'm not able to test on all Operating systems.
;you will need to verify on your OS that the below RegWrite paths are correct. If not correct for your OS
; then you will need to make a new IF statement to cover the paths you need.
 
  RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\", "DefaultUserName", "REG_SZ", @UserName)
  $Password = InputBox("Password", "Enter password for autologon" & @CR & $RebootCount & " restart(s) required", "", "*")
  RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\", "DefaultPassword", "REG_SZ", $Password)
  RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\", "AutoAdminLogon", "REG_SZ", "1")
  RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\", "AutoLogonCount", "REG_DWORD", $RebootCount)
  RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\", "DefaultDomainName", "REG_SZ", @LogonDomain)
EndIf
If $Ver = "WIN_98" Or $Ver = "WIN_95" Or $Ver = "WIN_ME" Then
  MsgBox(0, "", "Autologon currently not avialable for " & $OS)
EndIf
EndFunc   ;==>AutoLogon
;done
Func FindNumberOfSubcommands($tCounter)
$tSubCommands = 0
For $i = $tCounter To UBound($SelectedArray) - 1
  If $SelectedArray[$i][1] = "Section" Or $i = UBound($SelectedArray) - 1 Then
   Return $tSubCommands
  EndIf
  If $SelectedArray[$i][1] = "Run" Or $SelectedArray[$i][1] = "RunWait" Or $SelectedArray[$i][1] = "DOS" Or _
    $SelectedArray[$i][1] = "MSI" Or $SelectedArray[$i][1] = "REG" Or $SelectedArray[$i][1] = "WaitProcess" Then
   $tSubCommands = $tSubCommands + 1
  EndIf
  If $SelectedArray[$i][1] = "Folder" Then
   If $SelectedArray[$i + 1][1] = "FolderFiles" Then
    $tSubCommands = $tSubCommands + CountFiles($SelectedArray[$i][0], $SelectedArray[$i + 1][0])
   ElseIf $SelectedArray[$i + 2][1] = "FolderFiles" Then
    $tSubCommands = $tSubCommands + CountFiles($SelectedArray[$i][0], $SelectedArray[$i + 2][0])
   ElseIf $SelectedArray[$i + 3][1] = "FolderFiles" Then
    $tSubCommands = $tSubCommands + CountFiles($SelectedArray[$i][0], $SelectedArray[$i + 3][0])
   EndIf
  EndIf
Next
Return 0
EndFunc   ;==>FindNumberOfSubcommands
;done
Func WriteLog($tType, $tCommandType, $tCommand, $tError)
Select
  Case $tType = 1
   FileWriteLine($LogFile, "   " & @HOUR & ":" & @MIN & ":" & @SEC & " Start " & $tCommandType & " = " & $tCommand)
  Case $tType = 2
   If $tError = 1 Then
    FileWriteLine($LogFile, "!!!Error executing command!!!")
   EndIf
   FileWriteLine($LogFile, "   " & @HOUR & ":" & @MIN & ":" & @SEC & " End   " & $tCommandType & " = " & $tCommand)
  Case $tType = 0
   FileWriteLine($LogFile, @YEAR & ":" & @MON & ":" & @MDAY & " Installation started")
  Case $tType = 3
   FileWriteLine($LogFile, @YEAR & ":" & @MON & ":" & @MDAY & " Installation finished")
  Case $tType = 4
   FileWriteLine($LogFile, "   " & @HOUR & ":" & @MIN & ":" & @SEC & " Restarting")
   FileWriteLine($LogFile, "")
  Case Else
EndSelect
EndFunc   ;==>WriteLog
;done
Func Fileexist($tCondition, $tName, $tVersion)
$tTrue = 0
If $tCondition = 0 Then
  If FileExists($tName) = 1 Then
   Return 0
  Else
   Return 1
  EndIf
EndIf
If $tCondition = 1 Then
  If FileExists($tName) = 1 Then
   If $tVersion = "" Then
    Return 1
   Else
    $tEq = 0
    If StringInStr("<=>", StringLeft($tVersion, 1)) > 0 Then
     $tEq = 2 ^ StringInStr("<=>", StringLeft($tVersion, 1))
     $tVersion = StringTrimLeft($tVersion, 1)
    EndIf
    If StringInStr("<=>", StringLeft($tVersion, 1)) > 0 Then
     $tEq = $tEq + (2 ^ StringInStr("<=>", StringLeft($tVersion, 1)))
     $tVersion = StringTrimLeft($tVersion, 1)
    EndIf
    Select
     Case $tEq = 2
      Return (FileGetVersion($tName) < $tVersion)
     Case $tEq = 4
      Return (FileGetVersion($tName) = $tVersion)
     Case $tEq = 8
      Return (FileGetVersion($tName) > $tVersion)
     Case $tEq = 6
      Return (FileGetVersion($tName) <= $tVersion)
     Case $tEq = 10
      Return (FileGetVersion($tName) <> $tVersion)
     Case $tEq = 12
      Return (FileGetVersion($tName) >= $tVersion)
     Case Else
      Return 1
    EndSelect
   EndIf
  EndIf
  Return 0
EndIf
EndFunc   ;==>Fileexist
 
Func UpdateProgressBar($tItemStart, $tItemEnd, $tCurrentItem, $tArray, $tArrayItem, $tSubCommands)
$j = 1
$k = 0
GUICtrlSetPos($LabelDescription, 60, 1000, 220, 15)
GUICtrlSetPos($ProgressSubItems, 30, 1000, 240, 10)
For $i = $tItemStart To $tCurrentItem - 1
  GUICtrlSetPos($i, 30, 30 + ($j) * 15, 260, 15)
  GUICtrlSetFont($i, 10, 400)
  GUICtrlSetData($i, $tArray[$tArrayItem + $k])
  $k = $k + 1
  $j = $j + 1
Next
GUICtrlSetPos($tCurrentItem, 30, 30 + ($j) * 15, 260, 25)
GUICtrlSetData($tCurrentItem, $tArray[$tArrayItem + $k])
GUICtrlSetFont($tCurrentItem, 11, 646)
$k = $k + 1
If $tSubCommands > 2 Then
  GUICtrlSetPos($LabelDescription, 60, 30 + ($j + 2) * 15, 220, 20)
  GUICtrlSetData($LabelDescription, "test")
  GUICtrlSetPos($ProgressSubItems, 30, 35 + ($j + 1) * 15, 240, 10)
  GUICtrlSetData($ProgressSubItems, 10)
  $j = $j + 3
Else
  $j = $j + 1
EndIf
For $i = $tCurrentItem + 1 To $tItemEnd
  GUICtrlSetPos($i, 30, 35 + ($j) * 15, 260, 15)
  GUICtrlSetFont($i, 10, 400)
  GUICtrlSetData($i, $tArray[$tArrayItem + $k])
  $k = $k + 1
  $j = $j + 1
Next
EndFunc   ;==>UpdateProgressBar
Func SaveToFile($tFile, $tFrom) ;  Write selection to file
If $tFile = "" Then
  $tFile = FileSaveDialog("title", "c:\", "INI files (*.ini)", 16, "VollatranInstall.ini")
EndIf
$tOpenFile = FileOpen($tFile, 2)
If $tOpenFile = -1 Then
  MsgBox(0, "Error", "Unable to open file.")
  Return
EndIf
FileWriteLine($tOpenFile, "[Config]")
FileWriteLine($tOpenFile, "Append = " & IniRead($InstallFile, "Config", "Append", ""))
For $i = $tFrom To UBound($SelectedArray) - 1
  Select
   Case $SelectedArray[$i][1] = "Section"
    FileWriteLine($tOpenFile, "")
    FileWriteLine($tOpenFile, "[" & $SelectedArray[$i][0] & "]")
   Case $SelectedArray[$i][1] = "Reboot"
    FileWriteLine($tOpenFile, "Reboot")
   Case Else
    FileWriteLine($tOpenFile, $SelectedArray[$i][1] & " = " & $SelectedArray[$i][0])
  EndSelect
Next
FileClose($tOpenFile)
EndFunc   ;==>SaveToFile
Func Install()
WriteLog(0, 1, 1, 1)
Dim $tItems = 0
If $SoftwareToInstall = 0 Then ;check if anything selected
  Exit
EndIf
If $AutoLogon = 1 And $RebootCount > 0 Then AutoLogon()
;   $tContinue = StringSplit ( IniRead (@TempDir & "\VollatranInstall-temp.ini", "Config", "Continue", "" ), "|")
;   $tComtinue[1]; $i
;   $tComtinue[2]; $tSize
;   $tComtinue[3]; $ProgressOwerall
;   $tComtinue[4]; $tCounter
;   $tComtinue[5]; $tPlacehold
;   $tComtinue[6]; $tProgressItem
;   $tComtinue[7]; $LabelContext
If $ProgressType = 2 Then
  Dim $tSize
  Dim $SelectedSections = StringSplit(StringTrimLeft($Selected, 1), "|")
  If UBound($SelectedSections) - 1 < 18 Then
   $tSize = 15 * (UBound($SelectedSections) - 1)
  Else
   $tSize = 270
  EndIf
  GUICreate("Installing Applications", 300, $tSize + 130, 20, 20, -1, 0x00000008)
  GUISetFont(10, -1, -1, "Times New Roman")
  $PLabel1 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel2 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel3 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel4 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel5 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel6 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel7 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel8 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel9 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel10 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel11 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel12 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel13 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel14 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel15 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel16 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel17 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $PLabel18 = GUICtrlCreateLabel("", 30, 1000, 260, 15)
  $Overall = GUICtrlCreateLabel("Overall Progress", 30, $tSize + 105, 260, 25)
  GUICtrlSetFont(-1, 10, 646)
  $ProgressOverall = GUICtrlCreateProgress(30, $tSize + 85, 240, 20, 0x01)
  $LabelContext = GUICtrlCreateLabel("Installing Applications", 10, 10, 260, 20)
  GUICtrlSetFont(-1, 12, 646)
  Global $LabelDescription = GUICtrlCreateLabel("", 60, 1000, 260, 15)
  GUICtrlSetFont(-1, 9, 646)
  Global $ProgressSubItems = GUICtrlCreateProgress(30, 1000, 240, 15, 0x01)
  Dim $ProgressArray[19]
  $ProgressArray[1] = $PLabel1
  $ProgressArray[2] = $PLabel2
  $ProgressArray[3] = $PLabel3
  $ProgressArray[4] = $PLabel4
  $ProgressArray[5] = $PLabel5
  $ProgressArray[6] = $PLabel6
  $ProgressArray[7] = $PLabel7
  $ProgressArray[8] = $PLabel8
  $ProgressArray[9] = $PLabel9
  $ProgressArray[10] = $PLabel10
  $ProgressArray[11] = $PLabel11
  $ProgressArray[12] = $PLabel12
  $ProgressArray[13] = $PLabel13
  $ProgressArray[14] = $PLabel14
  $ProgressArray[15] = $PLabel15
  $ProgressArray[16] = $PLabel16
  $ProgressArray[17] = $PLabel17
  $ProgressArray[18] = $PLabel18
  GUISetState()
  $tCounter1 = 0
  $tPlacehold = 5
  Global $ProgressItem1 = IniRead($InstallFile, "Config", "Progress1", "1")
  Global $ProgressItem2 = IniRead($InstallFile, "Config", "Progress2", UBound($SelectedSections) - 1)
  $tProgressItem = 1
  For $i = 0 To UBound($SelectedArray) - 1
   Select
    Case $SelectedArray[$i][1] = "Section"
     $Subcommands = FindNumberOfSubcommands($i + 1)
     $CurrentSubCommand = 0
     GUICtrlSetData($ProgressOverall, 100 * ($ProgressItem1 - 1) / $ProgressItem2)
     Select
      Case UBound($SelectedSections) - 1 <= 18
       UpdateProgressBar($PLabel1, $ProgressArray[UBound($SelectedSections) - 1], $ProgressArray[$tProgressItem], $SelectedSections, 1, $Subcommands)
      Case $tProgressItem < 5
       UpdateProgressBar($PLabel1, $PLabel18, $ProgressArray[$tProgressItem], $SelectedSections, 1, $Subcommands)
      Case (UBound($SelectedSections) - 1) - $tProgressItem > 13
       UpdateProgressBar($PLabel1, $PLabel18, $ProgressArray[5], $SelectedSections, 1 + $tCounter1, $Subcommands)
       $tCounter1 = $tCounter1 + 1
      Case (UBound($SelectedSections) - 1) - $tProgressItem <= 13
       UpdateProgressBar($PLabel1, $PLabel18, $ProgressArray[$tPlacehold], $SelectedSections, 1 + $tCounter1, $Subcommands)
       $tPlacehold = $tPlacehold + 1
     EndSelect
     $tProgressItem = $tProgressItem + 1
     $ProgressItem1 = $ProgressItem1 + 1
    Case $SelectedArray[$i][1] = "Context"
     GUICtrlSetData($LabelContext, $SelectedArray[$i][0])
    Case $SelectedArray[$i][1] = "Description"
     $Description = $SelectedArray[$i][0]
     GUICtrlSetData($LabelDescription, $SelectedArray[$i][0])
    Case Else
     If $SelectedArray[$i][1] = "Run" Or $SelectedArray[$i][1] = "RunWait" Or $SelectedArray[$i][1] = "DOS" Or _
       $SelectedArray[$i][1] = "MSI" Or $SelectedArray[$i][1] = "REG" Or $SelectedArray[$i][1] = "WaitProcess" Then
      If $Subcommands > 2 Then
       GUICtrlSetData($ProgressSubItems, 100 * ($CurrentSubCommand) / $Subcommands)
       $CurrentSubCommand = $CurrentSubCommand + 1
      EndIf
     EndIf
     RunCommand($SelectedArray[$i][0], $SelectedArray[$i][1], $i)
   EndSelect
  Next
EndIf
If $ProgressType = 1 Then
  ProgressOn("Progress", "Software Installation", "   Overall progress", -1, -1, 16)
  For $i = 0 To UBound($SelectedArray) - 1
   If $SelectedArray[$i][1] = "Section" Then
    ProgressSet($tItems * 100 / $SoftwareToInstall, "   Overall progress - " & Round($tItems * 100 / $SoftwareToInstall) & _
      "%%", $SelectedArray[$i][0])
    $tItems = $tItems + 1
   Else
    RunCommand($SelectedArray[$i][0], $SelectedArray[$i][1], $i)
   EndIf
  Next
  ProgressSet(100, "   Overall progress - 100%%", "Finished")
  Sleep(1000)
EndIf
WriteLog(3, 1, 1, 1)
EndFunc   ;==>Install
;save current status on reboot missing
Func RunCommand($tCommand, $tType, ByRef $tCounter)
Select
  Case $tType = "Run"
   If $Log = 1 Then WriteLog(1, "Run", $Append & $tCommand, 0)
   Run($Append & $tCommand, "", $Flag)
   If $Log = 1 Then WriteLog(2, "Run", $Append & $tCommand, @error)
  Case $tType = "RunWait"
   If $Log = 1 Then WriteLog(1, "RunWait", $Append & $tCommand, 0)
   RunWait($Append & $tCommand, "", $Flag)
   If $Log = 1 Then WriteLog(2, "RunWait", $Append & $tCommand, @error)
  Case $tType = "MSI"
   If $Log = 1 Then WriteLog(1, "MSI", 'msiexec /i "' & $Append & $tCommand, 0)
   RunWait('msiexec /i "' & $Append & $tCommand, "", $Flag)
   If $Log = 1 Then WriteLog(2, "MSI", 'msiexec /i "' & $Append & $tCommand, @error)
  Case $tType = "DOS"
   If $Log = 1 Then WriteLog(1, "DOS", @ComSpec & " /c " & $tCommand, 0)
   RunWait(@ComSpec & " /c " & $tCommand, "", $Flag)
   If $Log = 1 Then WriteLog(2, "DOS", @ComSpec & " /c " & $tCommand, @error)
  Case $tType = "REG"
   If $Log = 1 Then WriteLog(1, "REG", 'regedit /s "' & $Append & $tCommand & '"', 0)
   RunWait('regedit /s "' & $Append & $tCommand & '"', "", $Flag)
   If $Log = 1 Then WriteLog(2, "REG", 'regedit /s "' & $Append & $tCommand & '"', @error)
  Case $tType = "WaitProcess"
   If $Log = 1 Then WriteLog(1, "WaitProcess", $tCommand, 0)
   ProcessWaitClose($tCommand)
   If $Log = 1 Then WriteLog(2, "WaitProcess", $tCommand, 0)
  Case $tType = "WinWaitClose"
   If $Log = 1 Then WriteLog(1, "WinWaitClose", $tCommand, 0)
   WinWait($tCommand)
   WinWaitClose($tCommand)
   If $Log = 1 Then WriteLog(2, "WinWaitClose", $tCommand, 0)
  Case $tType = "Reboot"
   If Mod($Reboot, 2) <> 0 Then
    If FindNextSection($SelectedArray, $tCounter) <> -1 Then ;section <> last?
     SaveToFile(@TempDir & "\Install-temp.ini", $tCounter + 1)
     RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce", "Install", "REG_SZ", '"' & _
       @ScriptFullPath & '" ' & @TempDir & "\Install-temp.ini 1")
     If $ProgressType = 2 Then
      IniWrite(@TempDir & "\Install-temp.ini", "Config", "Progress1", $ProgressItem1)
      IniWrite(@TempDir & "\Install-temp.ini", "Config", "Progress2", $ProgressItem2)
     EndIf
    EndIf
    WriteLog(4, 1, 1, 1)
    Reboot($RebootTimer)
   EndIf
  Case $tType = "Folder"
   $tFolder = $SelectedArray[$tCounter][0]
   $tSwitch = ""
   For $i = 1 To 3
    Select
     Case $SelectedArray[$tCounter + 1][1] = "FolderCommand"
      $tFCommand = $SelectedArray[$tCounter + 1][0]
      $tCounter = $tCounter + 1
     Case $SelectedArray[$tCounter + 1][1] = "FolderFiles"
      $tFileType = $SelectedArray[$tCounter + 1][0]
      $tCounter = $tCounter + 1
     Case $SelectedArray[$tCounter + 1][1] = "FolderSwitch"
      $tSwitch = $SelectedArray[$tCounter + 1][0]
      $tCounter = $tCounter + 1
     Case Else
    EndSelect
   Next
   If $tFolder <> "" And $tFileType <> "" And $tFCommand <> "" Then
    If $Log = 1 Then WriteLog(1, "Folder", $tFolder, 0)
    ProcessFolder($tFolder, $tFileType, $tFCommand, $tSwitch)
    If $Log = 1 Then WriteLog(2, "Folder", $tFolder, 0)
   EndIf
  Case $tType = "FileExist"
   $tVersion = ""
   $tFile = ""
   $tAction = ""
   $tCount = 0
   If $SelectedArray[$tCounter + 1][1] = "FileExistVersion" Then
    $tVersion = $SelectedArray[$tCounter + 1][0]
    $tCount = $tCount + 1
   EndIf
   If $SelectedArray[$tCounter + 1][1] = "FileExistAction" Then
    $tAction = $SelectedArray[$tCounter + 1][0]
    $tCount = $tCount + 1
   EndIf
   If $SelectedArray[$tCounter + 2][1] = "FileExistVersion" Then
    $tVersion = $SelectedArray[$tCounter + 2][0]
    $tCount = $tCount + 1
   EndIf
   If $SelectedArray[$tCounter + 2][1] = "FileExistAction" Then
    $tAction = $SelectedArray[$tCounter + 2][0]
    $tCount = $tCount + 1
   EndIf
   If Fileexist(1, $SelectedArray[$tCounter][0], $tVersion) = 1 Then
    $tCounter = $tCounter + $tCount
    If $tAction = "Skip" Then $tCounter = $tCounter + 1
    If $tAction = "SkipSection" Then $tCounter = FindNextSection($SelectedArray, $tCounter)
   EndIf
  Case $tType = "FileNotExist"
   If Fileexist(0, $SelectedArray[$tCounter][0], "") = 1 Then
    If $SelectedArray[$tCounter + 1][1] = "FileNotExistAction" Then
     $tAction = $SelectedArray[$tCounter + 1][0]
     $tCounter = $tCounter + 1
    EndIf
    If $tAction = "Skip" Then $tCounter = $tCounter + 1
    If $tAction = "SkipSection" Then $tCounter = FindNextSection($SelectedArray, $tCounter)
   EndIf
  Case Else
EndSelect
EndFunc   ;==>RunCommand
Func ProcessFolder($tFolder, $tFileType, $tCommand, $tSwitch)
If $tCommand <> "RunWait" And $tCommand <> "MSI" And $tCommand <> "REG" Then Return
$tFile = FileFindFirstFile($tFolder & "\*." & $tFileType)
If $tFile = -1 Then
  Return
EndIf
While 1
  $tNextFile = FileFindNextFile($tFile)
  If @error Then Return
  Select
   Case $tCommand = "RunWait"
    If $Log = 1 Then WriteLog(1, "   RunWait", $tFolder & "\" & $tNextFile & " " & $tSwitch, 0)
    If $Subcommands > 2 Then
     GUICtrlSetData($LabelDescription, $Description & " " & $tNextFile)
     GUICtrlSetData($ProgressSubItems, 100 * ($CurrentSubCommand) / $Subcommands)
     $CurrentSubCommand = $CurrentSubCommand + 1
    EndIf
    RunWait($tFolder & "\" & $tNextFile & " " & $tSwitch, "", $Flag)
    If $Log = 1 Then WriteLog(2, "   RunWait", $tFolder & "\" & $tNextFile & " " & $tSwitch, @error)
   Case $tCommand = "MSI"
    If $Log = 1 Then WriteLog(1, "   MSI", 'msiexec /i "' & $tFolder & "\" & $tNextFile & '" ' & $tSwitch, 0)
    If $Subcommands > 2 Then
     GUICtrlSetData($LabelDescription, $Description & " " & $tNextFile)
     GUICtrlSetData($ProgressSubItems, 100 * ($CurrentSubCommand) / $Subcommands)
     $CurrentSubCommand = $CurrentSubCommand + 1
    EndIf
    RunWait('msiexec /i "' & $tFolder & "\" & $tNextFile & '" ' & $tSwitch, "", $Flag)
    If $Log = 1 Then WriteLog(2, "   MSI", 'msiexec /i "' & $tFolder & "\" & $tNextFile & '" ' & $tSwitch, @error)
   Case $tCommand = "REG"
    If $Log = 1 Then WriteLog(1, "   REG", 'regedit /s "' & $tFolder & "\" & $tNextFile & '" ' & $tSwitch, 0)
    If $Subcommands > 2 Then
     GUICtrlSetData($LabelDescription, $Description & " " & $tNextFile)
     GUICtrlSetData($ProgressSubItems, 100 * ($CurrentSubCommand) / $Subcommands)
     $CurrentSubCommand = $CurrentSubCommand + 1
    EndIf
    RunWait('regedit /s "' & $tFolder & "\" & $tNextFile & '" ' & $tSwitch, "", $Flag)
    If $Log = 1 Then WriteLog(2, "   REG", 'regedit /s "' & $tFolder & "\" & $tNextFile & '" ' & $tSwitch, @error)
   Case Else
  EndSelect
WEnd
EndFunc   ;==>ProcessFolder
Func RegCheck($tAction, $tRegPath, $tKey)
EndFunc   ;==>RegCheck
;continue after restart (save all items, where to start, owerall progress)
;regcheck
;-----------------------------------------------------
Func _inicheck()
$versioncheck1 = FileExists(@ScriptDir & "\config\" & $Ver & ".ini")
if $versioncheck1 = 0 then
  MsgBox(0, "Error", "The INI file for this OS is not found. The supported OS are:"& @CRLF _
                    &""& @CRLF _
        &"  Windows 95"& @CRLF _
        &"  Windows 98"& @CRLF _
        &"  Windows ME"& @CRLF _
        &"  Windows NT4"& @CRLF _
        &"  Windows 2000"& @CRLF _
        &"  Windows XP 32 Bit"& @CRLF _
        &"  Windows XP 64 Bit"& @CRLF _
        &"  Windows Server 2003"& @CRLF _
        &"  Windows Vista"& @CRLF _
        &"  Windows Server 2008"& @CRLF _
        &"  Windows 7 32 Bit"& @CRLF _
        &"  Windows 7 64 Bit"& @CRLF _
        &""& @CRLF _
        &"                               Click OK to exit.")
  Exit
EndIf
EndFunc

Additional files that are needed BEFORE you run the script: config.zip

Warning: if you run the script without these files you will get an error then the script will exit.

Supported Operating Systems:

Windows 95

Windows NT4

Windows 98

Windows ME

Windows 2000

Windows XP 32 Bit

Windows XP 64 Bit

Windows Server 2003

Windows Vista

Windows Server 2008

Windows 7 32 Bit

Windows 7 64 Bit

Instructions to examine code and to run from SciTE:

1. Copy the code in the Main Script code box below to SciTE. Save the code in it's own folder and call it install.au3.

2. In the same folder where the install.au3 script is located create a new folder and call it "config". You will be placing the config files in this folder.

3. Download config.zip and unzip in the config folder. THERE SHOULD BE NO SUB FOLDERS IN THE CONFIG FOLDER.

4. Run the script in SciTE.

Now, I coded it to support XP 32 and 64 bit, WIndows 7 32 and 64 bit as well as other operating systems. If you need other Operating systems added, it is easy to add. Do this:

On line 80 you will find the function ReturnOSVersion(). This function is what you edit to add support for other operating systems. (Only Windows based, not Linux!)

For example I want to add support for Windows Vista 64 bit. I will change:

Case $Ver = "WIN_VISTA"
$OS = "Windows Vista"

to

Case $Ver = "WIN_VISTA"
  If @OSArch = "X86" then
   $Ver = "WIN_VISTA_32"    
   $OS = "Windows Vista - 32Bit  "
  EndIf
  If @OSArch = "X64" then
    $Ver = "WIN_VISTA_64"   
    $OS = "Windows Vista - 64Bit  "
  EndIf

Second: You also will need to create a ini file to go along with the new Windows version you want supported. In the above example I created support for 32 bit and 64 bit Windows Vista. You will find in the config folder an INI called "win_vista.ini". Simply create a copy of this file and call it win_vista_64.ini. Then rename "win_vista.ini" to "win_vista_32.ini". The important thing to remember here is the name of the INI file has to be the same as the $Ver you use.

Now, to edit the INI file for the OS in question. When you want to add a app to install you need to have the package already built for it. In other words: for example if you wanted to install Office 2010 you will need to have produced the autoit installation script, compiled it, and have it ready to run if needed.

To add the path to the install file you would do something like this:

[   Office 2010]
Context = Installing Office 2010
runwait = \\Server\APPS\Microsoft Products\MS_Office_2010\Office 2010\install.exe
[]

To explain the above example:

[ Office 2010] - The first line is like a section header. It is what will be listed as the name of the application in your app list in the Right window.

"Context" is what will be displayed in the popup window while the app is installing.

"Runwait" is the command that launches the app.

[] puts a row space in the list

For the most part Runwait is usually what you will use for installing applications. The reason is you do not want multiple apps installing at once. This can cause issues.

In other cases you can use "msiexec" if the package you have is a MSI package and you want to use command line switches as shown in the below example:

[   Single Signon manager]
context = Installing Single Signon manager
runwait = msiexec /i "\\Server\APPS\Single_Signon_Manager\SSO_v6\NovellSecureLogin_6.0.msi" /passive /norestart
runwait = msiexec /i "\\Server\APPS\Single_Signon_Manager\SSO_v6\NovellSecureLogin_6.0_Patch.msi" /passive /norestart
[]

The big thing to remember is this tool is in a nutshell a simple way to point to your install scripts, applications, or tools you want to run. As long as you run the tool from a place that the INI file's settings are correct the tool will work. We use ours from a server so we can access it from any PC in the building.

Change Log: Version 1 posted

Future plans (when I have time or if someone wants to contribute to the project):

1. Add a GUI tool to edit the INI files. (See 2nd port in this thread)

2. Add Software uninstall tool (See 3rd post in this thread)

3. Add Software license management support (see 4th post in this thread)

4. Add help file (See 5th post in this thread)

5. Add support for order the software gets installed

6. Add other ideas from other users.

Disclaimer: Use this script and tools at your own risk. This script is opensource and by using this code in its current form you agree to hold the original author and all other contributors harmless.

Release notes:

At this time the script does not support the latest beta release of Windows 8.

Edited by Bert
Link to comment
Share on other sites

GUI tool to edit the INI files. In Development

The following script is a GUI prototype of what I have in mind to edit the Operating System INI files.

Note: the ico file referenced on row 10 can be downloaded here: Tools.ico

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
 
$Form1 =      GUICreate("Vollatran - Add/Remove Program", 737, 449, 192, 114)
              GUISetIcon(@ScriptDir&"\config\Tools.ico", -1)
$Input1 =    GUICtrlCreateInput("", 9, 47, 321, 21)
$Label1 =    GUICtrlCreateLabel("Program name", 9, 30, 72, 17)
$Label2 =    GUICtrlCreateLabel("Add/Remove program to list of available programs to install", 127, 6, 475, 24)
              GUICtrlSetFont($Label2, 12, 800, 0, "MS Sans Serif")
$Label3 =    GUICtrlCreateLabel("Path", 9, 72, 26, 17)
$Input2 =    GUICtrlCreateInput("", 9, 90, 321, 21)
$Select =    GUICtrlCreateButton("Select", 337, 90, 89, 21)
$Label4 =    GUICtrlCreateLabel("Type of file action", 9, 116, 86, 17)
$Combo1 =    GUICtrlCreateCombo("", 9, 135, 153, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
              GUICtrlSetData($Combo1, "Run|RunWait|MSI|DOS|REG|WaitProcess|WinWaitClose", "Run") ; add other item snd set a new default
$Label5 =    GUICtrlCreateLabel("Command line switches", 9, 163, 114, 17)
$Input3 =    GUICtrlCreateInput("", 9, 181, 321, 21)
$Label6 =    GUICtrlCreateLabel("Select the OS you want this program to be available to:", 9, 272, 262, 17)
$Checkbox1 =  GUICtrlCreateCheckbox("Windows 95", 9, 295, 97, 15)
$Checkbox2 =  GUICtrlCreateCheckbox("Windows 98", 9, 318, 97, 15)
$Checkbox3 =  GUICtrlCreateCheckbox("Windows ME", 9, 363, 104, 15)
$Checkbox4 =  GUICtrlCreateCheckbox("Windows NT4", 9, 340, 104, 15)
$Checkbox5 =  GUICtrlCreateCheckbox("Windows 2000", 136, 295, 97, 15)
$Checkbox6 =  GUICtrlCreateCheckbox("Windows XP 32 Bit", 136, 318, 121, 15)
$Checkbox7 =  GUICtrlCreateCheckbox("Windows XP 64 Bit", 136, 363, 128, 15)
$Checkbox8 =  GUICtrlCreateCheckbox("Windows Server 2003", 136, 340, 130, 15)
$Checkbox9 =  GUICtrlCreateCheckbox("Windows Vista", 291, 295, 97, 15)
$Checkbox10 = GUICtrlCreateCheckbox("Windows Server 2008", 291, 318, 130, 15)
$Checkbox11 = GUICtrlCreateCheckbox("Windows 7 32 Bit", 291, 363, 128, 15)
$Checkbox12 = GUICtrlCreateCheckbox("Windows 7 64 Bit", 291, 340, 120, 15)
$Combo2 =    GUICtrlCreateCombo("", 8, 228, 153, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Button1 =  GUICtrlCreateButton("New Group", 176, 228, 73, 21)
$Button2 =  GUICtrlCreateButton("Add program", 152, 395, 121, 33)
$Button3 =  GUICtrlCreateButton("Remove program", 472, 397, 105, 33)
$Label7 =    GUICtrlCreateLabel("Add to group (optional)", 9, 206, 111, 17)
$Button4 =  GUICtrlCreateButton("Remove Group name", 615, 398, 113, 33)
 
;tabs
$Win_OS =    GUICtrlCreateTab(472, 31, 257, 337)
$Win_95 = GUICtrlCreateTabItem("Windows 95")
$Edit1 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit1, "Edit1")
$Win_98 =GUICtrlCreateTabItem("Windows 98")
$Edit2 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit2, "Edit2")
$Win_ME = GUICtrlCreateTabItem("Windows ME")
$Edit3 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit3, "Edit3")
$Win_NT4 =GUICtrlCreateTabItem("Windows NT4")
$Edit4 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit4, "Edit4")
$Win_2000 = GUICtrlCreateTabItem("Windows 2000")
$Edit5 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit5, "Edit5")
$Win_XP_32 =GUICtrlCreateTabItem("Windows XP 32 Bit")
$Edit6 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit6, "Edit6")
$Win_XP_64 = GUICtrlCreateTabItem("Windows XP 64 Bit")
$Edit7 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit7, "Edit7")
$Win_2003 =GUICtrlCreateTabItem("Windows Server 2003")
$Edit8 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit8, "Edit8")
$Win_Vista = GUICtrlCreateTabItem("Windows Vista")
$Edit9 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit9, "Edit9")
$Win_2008 =GUICtrlCreateTabItem("Windows Server 2008")
$Edit10 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit10, "Edit10")
$Win_7_32 = GUICtrlCreateTabItem("Windows 7 32 Bit")
$Edit11 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit11, "Edit11")
$Win_7_64 =GUICtrlCreateTabItem("Windows 7 64 Bit")
$Edit12 = GUICtrlCreateEdit("", 480, 60, 241, 300)
GUICtrlSetData($Edit12, "Edit12")
 
GUISetState(@SW_SHOW)
 
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Edited by MPH
Link to comment
Share on other sites

Thanks it looks interesting, i have a similar thing written in cmd although a lot more basic, it just deals with the software we repeatedly use on all fresh installs.

Ill keep watching

Edited by Chimaera
Link to comment
Share on other sites

The following post was lifted from a PM I had posted a while back. Some of you may find it interesting and help in using Vollatran:

1. Use Vollatran on a backpack or thumb drive

2. Shortcuts or alternative methods to scripting installs

It is easy to point to the backpack. All you need to do it make a sub folder in the same folder you have your script. Put your scripts there. The files and folders in the root folder should look like this:

Config folder

Bin folder (where you keep your apps you install)

Vollatran.exe (the installer app. It is what I named it, you can name it what you like)

---------------

Once you have setup your file structure for your apps off the bin folder you can map to them in the ini files like this example:

[test]
context = running path test from bin
runwait = bin\test\msgtest.exe
 
[]
 
[-OFFICE-]
 
[Microsoft Office 2010]
context = Installing Office 2010
runwait = bin\Microsoft\office 2010\install2010.exe

What application are you trying to script to install? In many cases the installer that comes with the application supports command line switches or an answer file. When this is true then installation is easy. For example, the application ccleaner from Piriform supports command line switches.

http://www.piriform.com/ccleaner/faq/ins...n-ccleaner-be-installed-and-ru

It is simple then to run the install. Just point to the setup.exe in the ini and add the correct switch. No messing around with AutoIt trying to script each screen. You can look in the example I give to run a MSI package and you see how I use command line switches there if you need to see it first hand.

In other cases some folks will build a custom installer with InstallShield or Wise. What they do here is use a virtual PC that ha no apps loaded other than the version of Windows they want to install the app to. They take a "Snapshot" of the virtual machine to get all the settings, files and so forth. They then install the application and then take a second "Snapshot". Next they compare the two snapshots, seeing what is different. They take all the files and settings they find and build a installer package. It is a bit more labor intensive to setup but the beauty is one can setup the app to the exact specification they want. For example the app you want to install adds the yahoo toolbar to Internet Explorer. You can use this method to build a package but remove this feature.

Edited by MPH
Link to comment
Share on other sites

I've been sidetracked since I last wrote to you. :)

But I've had a quick look over the script and it looks great!

When I get time I'll convert over some of my batch files and see how it goes in real world situation. :graduated:

Expect seom questions. ;)

Thanks for sharing.

John

Link to comment
Share on other sites

I tried to download the config.zip and i get this errror

[#10171] You do not have permission to view this attachment.

Is there a public download plz?

Edited by Chimaera
Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...
  • 1 month later...

This is great yogi!

I have written a few similer tools, so if you ever need help tweaking this, feel free to ask. ;)

Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 
Link to comment
Share on other sites

  • 5 months later...

Hi MVP can you please help me get this done I have been days searching for hoe to do this, nothing makes sense and still dont have my installer i am tring to create. If you could  help i would appreciate it,. I have posted what i am trying to do im my other post. basically i need a cd that when inserted will autorun and the 10 programs I have and the 10th program has to aske me or auto ditect what bit system I am running a 32bit or a 64bit. PLease please Help

Thanks in advance

clo312

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

×
×
  • Create New...