Jump to content
Sign in to follow this  
jazzyjeff

Installer Program

Recommended Posts

jazzyjeff

Hello,

I am working a program that can install either one or mulitple programs one after the other. I have a couple of issues.

1. After running the "Execute" button the program runs, but if I want to run that some program again it stops responding. I thought an ExitLoop might fix this, but it didn't.

2. Using the AU3Record program I recorded the installation of Symantec Ghost Client, and then for each school I would change the IP address of our Ghost server. It determines the school to install to via a drop down menu, but I am not sure if I have code setup correctly.

Here is the entire script:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

; School Variables
$BL = "School 1"
$CE = "School 2"
$CK = "School 3"
$CO = "School 4"
$EA = "School 5"
$IN = "School 6"
$LL = "School 7"
$MO = "School 8"
$OM = "School 9"
$SL = "School 10"
$TH = "School 11"
$WW = "School 12"
$WH = "School 13"

#region ### START Koda GUI section ### 
$mainForm = GUICreate("TCAPS-Installer", 360, 255, 192, 124)
$menuFile = GUICtrlCreateMenu("&File")
$menuExit = GUICtrlCreateMenuItem("Exit", $menuFile)
$menuHelp = GUICtrlCreateMenu("&Help")
$menuAbout = GUICtrlCreateMenuItem("About School-Installer", $menuHelp)
$btnExecute = GUICtrlCreateButton("Execute", 192, 104, 75, 25, $WS_GROUP)
$comboSchools = GUICtrlCreateCombo("", 192, 72, 145, 25)
GUICtrlSetData($comboSchools, $BL & "|" & $CE & "|" & $CK & "|" & $CO & "|" & $EA & "|" & $IN & "|" & $LL & "|" & $MO & "|" & $OM & "|" & $SL & "|" & $TH & "|" & $WW & "|" & $WH)
$TabWin = GUICtrlCreateTab(8, 16, 177, 201)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$tabProg = GUICtrlCreateTabItem("Programs")
$rGPUpdate = GUICtrlCreateRadio("GP Update", 15, 46, 113, 17)
$rIntelProf = GUICtrlCreateRadio("Intel Wireless Profile", 15, 62, 113, 17)
$rIntelRepair = GUICtrlCreateRadio("Intel Wireless Repair", 15, 78, 121, 17)
$rGhost = GUICtrlCreateRadio("Ghost Client", 15, 94, 113, 17)
$rRFBA = GUICtrlCreateRadio("RFBA Client", 15, 110, 113, 17)
$rSAM = GUICtrlCreateRadio("SAM Client", 15, 126, 113, 17)
$rMSAccess = GUICtrlCreateRadio("Microsoft Access 2000", 15, 142, 137, 17)
$rMSOutlook = GUICtrlCreateRadio("Microsoft Outlook 2003", 15, 158, 137, 17)
$rDFSeed = GUICtrlCreateRadio("Deepfreeze Seed", 15, 174, 113, 17)
$rDFWkstn = GUICtrlCreateRadio("Deepfreeze Workstation", 15, 190, 137, 17)
$tabInst = GUICtrlCreateTabItem("Multiple Installs")
$cDFWkstn = GUICtrlCreateCheckbox("Deepfreeze Workstation", 12, 193, 137, 17)
$cDFSeed = GUICtrlCreateCheckbox("Deepfreeze Seed", 12, 177, 105, 17)
$cGPUpdate = GUICtrlCreateCheckbox("GP Update", 12, 49, 97, 17)
$cIntelProf = GUICtrlCreateCheckbox("Intel Wireless Profile", 12, 65, 129, 17)
$cIntelRepair = GUICtrlCreateCheckbox("Intel Wireless Repair", 12, 81, 129, 17)
$cGhost = GUICtrlCreateCheckbox("Ghost Client", 12, 97, 97, 17)
$cRFBA = GUICtrlCreateCheckbox("RFBA Client", 12, 113, 97, 17)
$cSAM = GUICtrlCreateCheckbox("SAM Client", 12, 129, 97, 17)
$cMSAccess = GUICtrlCreateCheckbox("Microsoft Access 2000", 12, 145, 137, 17)
$cMSOutlook = GUICtrlCreateCheckbox("Microsoft Outlook 2003", 12, 161, 129, 17)
GUICtrlCreateTabItem("")
$lblSchools = GUICtrlCreateLabel("Select School Building", 192, 48, 132, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE

        Case $menuAbout
            MsgBox("", "About School-Installer", "School Installer - Version 0.1")

        Case $menuExit
            Exit

        Case $btnExecute
            ;Intel Wireless Profile
            If BitAND(GUICtrlRead($cIntelProf), $GUI_CHECKED) = $GUI_CHECKED Then IntelProfile()
            If BitAND(GUICtrlRead($rIntelProf), $GUI_CHECKED) = $GUI_CHECKED Then IntelProfile()
            ;GPUpdate
            If BitAND(GUICtrlRead($cGPUpdate), $GUI_CHECKED) = $GUI_CHECKED Then GPUpdater()
            If BitAND(GUICtrlRead($rGPUpdate), $GUI_CHECKED) = $GUI_CHECKED Then GPUpdater()
            ;Ghost Client
            If BitAND(GUICtrlRead($cGhost), $GUI_CHECKED) = $GUI_CHECKED Then GhostClient()
            If BitAND(GUICtrlRead($rGhost), $GUI_CHECKED) = $GUI_CHECKED Then GhostClient()
            ExitLoop
    EndSwitch
WEnd

Global $IP, $schCode

Func _WinWaitActivate($title, $text, $timeout = 0)
    WinWait($title, $text, $timeout)
    If Not WinActive($title, $text) Then WinActivate($title, $text)
    WinWaitActive($title, $text, $timeout)
EndFunc   ;==>_WinWaitActivate

; Install Intel Wireless Profile for School network
Func IntelProfile()
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run", "")
    Send("c{SHIFTDOWN};{SHIFTUP}\windows\{SHIFTDOWN}1{SHIFTUP}drivercache\intel 3945 ABG Drivers and Wireless Profile\School{SHIFTDOWN}-{SHIFTUP}v3.exe{ENTER}")
EndFunc   ;==>IntelProfile

; Run GPUpdate
Func GPUpdater()
    Run("gpupdate /force")
    _WinWaitActivate("C:\WINDOWS\system32\gpupdate.exe", "")
    Send("n{ENTER}n{ENTER}")
EndFunc   ;==>GPUpdater

; Install the Ghost client and configure it for the relevant server
Func GhostClient()
    If $comboSchools = $BL Then
        $IP = "10.x.1.20"
        $schCode = "BL"
    ElseIf $comboSchools = $CE Then
        $IP = "10.x.1.20"
        $schCode = "CE"
    ElseIf $comboSchools = $CO Then
        $IP = "10.x.1.20"
        $schCode = "CO"
    ElseIf $comboSchools = $EA Then
        $IP = "10.x.1.20"
        $schCode = "EA"
    ElseIf $comboSchools = $IN Then
        $IP = "10.x.1.20"
        $schCode = "IN"
    ElseIf $comboSchools = $LL Then
        $IP = "10.x.1.20"
        $schCode = "LL"
    ElseIf $comboSchools = $MO Then
        $IP = "10.x.1.20"
        $schCode = "MO"
    ElseIf $comboSchools = $OM Then
        $IP = "10.x.1.20"
        $schCode = "OM"
    ElseIf $comboSchools = $SL Then
        $IP = "10.x.1.20"
        $schCode = "SL"
    ElseIf $comboSchools = $TH Then
        $IP = "10.x.1.20"
        $schCode = "TH"
    ElseIf $comboSchools = $WW Then
        $IP = "10.x.1.20"
        $schCode = "WW"
    ElseIf $comboSchools = $WH Then
        $IP = "10.x.1.20"
        $schCode = "WH"
    EndIf
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run", "Type the name of a p")
    Send("\\servername\toolbox{SHIFTDOWN}4{SHIFTUP}\deployment{SPACE}drive{ENTER}")
    _WinWaitActivate("deployment drive", "FolderView")
    Send("{DOWN}{UP}{ENTER}")
    _WinWaitActivate("Elementary", "FolderView")
    Send("{DOWN}{DOWN}{ENTER}")
    _WinWaitActivate("3 - Ghost Client", "FolderView")
    Send("cl{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield(R)")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "I &do not accept the")
    Send("{UP}{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "If you leave this fi")
    Send($IP & "{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "Click Next to instal")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The wizard is ready ")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield Wi")
    Send("{ENTER}")
    ; Install Pubkey file for the Ghost client
    Run("\\servername\toolbox$\Deployment Drive\Elementary\3 - Ghost Client\" & $schCode & "\Copy Pubkey.bat")
    WinWait("C:\WINDOWS\system32\cmd.exe", "", 5)
EndFunc   ;==>GhostClient

I think this is the part that is broken for the Symantec Ghost installation. The installation runs, but it doesn't seem to be connecting to the right server, so I don't think it is inputting my address correctly:

; Install the Ghost client and configure it for the relevant server
Func GhostClient()
    If $comboSchools = $BL Then
        $IP = "10.x.1.20"
        $schCode = "BL"
    ElseIf $comboSchools = $CE Then
        $IP = "10.x.1.20"
        $schCode = "CE"
    ElseIf $comboSchools = $CO Then
        $IP = "10.x.1.20"
        $schCode = "CO"
    ElseIf $comboSchools = $EA Then
        $IP = "10.x.1.20"
        $schCode = "EA"
    ElseIf $comboSchools = $IN Then
        $IP = "10.x.1.20"
        $schCode = "IN"
    ElseIf $comboSchools = $LL Then
        $IP = "10.x.1.20"
        $schCode = "LL"
    ElseIf $comboSchools = $MO Then
        $IP = "10.x.1.20"
        $schCode = "MO"
    ElseIf $comboSchools = $OM Then
        $IP = "10.x.1.20"
        $schCode = "OM"
    ElseIf $comboSchools = $SL Then
        $IP = "10.x.1.20"
        $schCode = "SL"
    ElseIf $comboSchools = $TH Then
        $IP = "10.x.1.20"
        $schCode = "TH"
    ElseIf $comboSchools = $WW Then
        $IP = "10.x.1.20"
        $schCode = "WW"
    ElseIf $comboSchools = $WH Then
        $IP = "10.x.1.20"
        $schCode = "WH"
    EndIf
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run", "Type the name of a p")
    Send("\\servername\toolbox{SHIFTDOWN}4{SHIFTUP}\deployment{SPACE}drive{ENTER}")
    _WinWaitActivate("deployment drive", "FolderView")
    Send("{DOWN}{UP}{ENTER}")
    _WinWaitActivate("Elementary", "FolderView")
    Send("{DOWN}{DOWN}{ENTER}")
    _WinWaitActivate("3 - Ghost Client", "FolderView")
    Send("cl{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield(R)")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "I &do not accept the")
    Send("{UP}{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "If you leave this fi")
    Send($IP & "{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "Click Next to instal")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The wizard is ready ")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield Wi")
    Send("{ENTER}")
    ; Install Pubkey file for the Ghost client
    Run("\\servername\toolbox$\Deployment Drive\Elementary\3 - Ghost Client\" & $schCode & "\Copy Pubkey.bat")
    WinWait("C:\WINDOWS\system32\cmd.exe", "", 5)
EndFunc   ;==>GhostClient

I think I could probably use the following method if this way isn't good

Func GhostClient()
If $comboSchools = $BL Then
I run the entire script with the specific IP address builtin
ElseIf $comboSchools = $CE Then
I run the same script again, but I just modify the IP address.

This would be a long process and I can't help thinking there is a better way, but I could do with some help.

Thanks,

Jeff

Share this post


Link to post
Share on other sites
jazzyjeff

OK so I have tried the code below, but I am still having issues getting this function to work. I am actually having worse luck now, as the Ghost installation does even start. This leads me to believe that the Function is causing the problem.

Func GhostClient()
Local $Blair,$CentralGrade,$Courtade,$Eastern
Select
Case $Blair
    If $comboSchools = $BL Then
    ; Install Ghost for Blair
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run","")
    Send("\\techstore1\toolbox$\deployment drive\Elementary\3 - Ghost Client\client.msi{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield(R)")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "I &do not accept the")
    Send("{UP}{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "If you leave this fi")
    Send("10.9.1.20{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "Click Next to instal")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The wizard is ready ")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield Wi")
    Send("{ENTER}")
    ; Install Pubkey file for the Ghost client
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run","")
    Send("\\techstore1\toolbox$\Deployment Drive\Elementary\3 - Ghost Client\BL\Copy Pubkey.bat{ENTER}")
    _WinWaitActivate("C:\WINDOWS\system32\cmd.exe","")
    Send("{ENTER}")
    EndIf

Case $CentralGrade
    ; Install Ghost for Central Grade
    If $comboSchools = $CE Then
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run","")
    Send("\\techstore1\toolbox$\deployment drive\Elementary\3 - Ghost Client\client.msi{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield(R)")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "I &do not accept the")
    Send("{UP}{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "If you leave this fi")
    Send("10.12.1.20{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "Click Next to instal")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The wizard is ready ")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield Wi")
    Send("{ENTER}")
    ; Install Pubkey file for the Ghost client
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run","")
    Send("\\techstore1\toolbox$\Deployment Drive\Elementary\3 - Ghost Client\CE\Copy Pubkey.bat{ENTER}")
    _WinWaitActivate("C:\WINDOWS\system32\cmd.exe","")
    Send("{ENTER}")
    EndIf

Case $Courtade
    ; Install Ghost for Courtade
    If $comboSchools = $CO Then
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run","")
    Send("\\techstore1\toolbox$\deployment drive\Elementary\3 - Ghost Client\client.msi{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield(R)")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "I &do not accept the")
    Send("{UP}{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "If you leave this fi")
    Send("10.7.1.20{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "Click Next to instal")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The wizard is ready ")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield Wi")
    Send("{ENTER}")
    ; Install Pubkey file for the Ghost client
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run","")
    Send("\\techstore1\toolbox$\Deployment Drive\Elementary\3 - Ghost Client\CO\Copy Pubkey.bat{ENTER}")
    _WinWaitActivate("C:\WINDOWS\system32\cmd.exe","")
    Send("{ENTER}")
    EndIf

Case $Eastern
    ; Install Ghost for Eastern
    If $comboSchools = $EA Then
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run","")
    Send("\\techstore1\toolbox$\deployment drive\Elementary\3 - Ghost Client\client.msi{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield(R)")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "I &do not accept the")
    Send("{UP}{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "If you leave this fi")
    Send("10.15.1.20{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "Click Next to instal")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The wizard is ready ")
    Send("{ENTER}")
    _WinWaitActivate("Symantec Ghost Managed Console Client 11.01 - InstallShield Wizard", "The InstallShield Wi")
    Send("{ENTER}")
    ; Install Pubkey file for the Ghost client
    Send("{LWINDOWN}r{LWINUP}")
    _WinWaitActivate("Run","")
    Send("\\techstore1\toolbox$\Deployment Drive\Elementary\3 - Ghost Client\EA\Copy Pubkey.bat{ENTER}")
    _WinWaitActivate("C:\WINDOWS\system32\cmd.exe","")
    Send("{ENTER}")
    EndIf
EndSelect
EndFunc   ;==>GhostClient

If anyone has a solution I'd be very grateful.

Thanks,

Jeff

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.