Jump to content

my first AutoIT software installation script


ddelgado
 Share

Recommended Posts

So with a little guidance from youtube, I setup an unattended software install script.  I believe it was successful and I've tested both the 32bit and 64bit executable after compiling. 

I then decided to move the executable to a network drive so we can install the program on 100 computers via a logon script.  this is where I started running into some trouble.  The script successfully clicks next and starts the installation process but when the setup begins copying files, it hangs and the system tray states the script has paused.  I eventually get an error that comes up which says a glb896e.tmp file is not responding when I try to cancel or end the setup. 

My first guess is that it is taking longer now that it's on the network drive and we need to give the script more time to process the actually installation and copying files.  The system hangs right after line 41 which I've labeled below. 

 

I copied the entire script below.  Any help would be greatly appreciated...

Note: I've added a controlclick on line 42 for a pop up error that comes up relating to a file being in use.  I've also tried removing this line to test the issue when running the exe from the network. 

 

#RequireAdmin
ShellExecute("specIT-v104.00.exe")
WinWait("specIT - v104.00","Welcome to specIT Setup program.")
WinActivate("specIT - v104.00","Welcome to specIT Setup program.")
ControlClick("specIT - v104.00","Welcome to specIT Setup program.",3)
WinWait("specIT - v104.00","specIT End User License Agreement")
WinActivate("specIT - v104.00","specIT End User License Agreement")
ControlClick("specIT - v104.00","specIT End User License Agreement",8)
WinWait("specIT - v104.00","specIT End User License Agreement")
WinActivate("specIT - v104.00","specIT End User License Agreement")
ControlClick("specIT - v104.00","specIT End User License Agreement",3)
WinWait("specIT - v104.00","Setup will install specIT in the following folder.")
WinActivate("specIT - v104.00","Setup will install specIT in the following folder.")
ControlClick("specIT - v104.00","Setup will install specIT in the following folder.",3)
WinWait("specIT - v104.00","Please choose an installation type")
WinActivate("specIT - v104.00","Please choose an installation type")
ControlClick("specIT - v104.00","Please choose an installation type",8)
WinWait("specIT - v104.00","Please choose an installation type")
WinActivate("specIT - v104.00","Please choose an installation type")
ControlClick("specIT - v104.00","Please choose an installation type",3)
WinWait("specIT - v104.00","Please choose US or Canadian list pricing")
WinActivate("specIT - v104.00","Please choose US or Canadian list pricing")
ControlClick("specIT - v104.00","Please choose US or Canadian list pricing",8)
WinWait("specIT - v104.00","Please choose US or Canadian list pricing")
WinActivate("specIT - v104.00","Please choose US or Canadian list pricing")
ControlClick("specIT - v104.00","Please choose US or Canadian list pricing",3)
WinWait("specIT","You are now ready to install specIT.")
WinActivate("specIT","You are now ready to install specIT.")
ControlClick("specIT","You are now ready to install specIT.",3)    <------------------------------------------------------- Line 41
WinWait("Remove Shared File?","The system indicates that the following")<-------------------------------------------------------Line 42
WinActivate("Remove Shared File?","The system indicates that the following")
ControlClick("Remove Shared File?","The system indicates that the following",6)
WinWait("specIT - v104.00","specIT has been successfully installed.")
WinActivate("specIT - v104.00","specIT has been successfully installed.")
ControlClick("specIT - v104.00","specIT has been successfully installed.",3)

 

 

 

Link to comment
Share on other sites

Do you know if the installer has silent install command line switches?  That would make it much easier for installation, instead of automating the installation GUI.  You could interrogate the EXE in the command prompt with "specIT-v104.00.exe /?", and see if returns anything.  

 

Adam

Link to comment
Share on other sites

Do you know if the installer has silent install command line switches?  That would make it much easier for installation, instead of automating the installation GUI.  You could interrogate the EXE in the command prompt with "specIT-v104.00.exe /?", and see if returns anything.  

 

Adam

Adam, thanks for the quick reply.  I was under the impression that only msi's work with silent switches but Thanks for pointing that out.  I will test the exe with a switch s?  /s???

Link to comment
Share on other sites

  • Moderators

Many setup.exe files are simply wrappers for the MSI, so the company can control the install. You can check the file with /? to see if they publish any switches. If not, if you can post a link to the site, they may have documentation.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

No, not just MSI.  I would try the with /? first to see if the installer will tell you what its switches are.  There are all types of installers out there.  Some use /S, /s, -s, /SILENT, or  /VERYSILENT.  Some allow you create a response file with -r.  If you can find out the installer, then you can find out what the switches are. Most installers have them.  

You could also contact the vendor, and find out what installer is used.  I had to do this with some tricky installs.  

 

Adam

Link to comment
Share on other sites

Many setup.exe files are simply wrappers for the MSI, so the company can control the install. You can check the file with /? to see if they publish any switches. If not, if you can post a link to the site, they may have documentation.

I tried the /? and it didn't return anything.  Here is the link: https://kiosk.hermanmiller.com/1to1/specitinstall.nsf

Right now I'm working on the following:

 

specIT Full Install:

Click here to launch the full install of specIT version 104.00

Link to comment
Share on other sites

From running the installation, it uses Wise Installation Wizard, but it doesn't want to respond to any command line switches.  This looks like an old installer too.  You could try repackaging it with the AppDeploy Repackager.  

From running the installer, it does take quite some time, and has a lot of files.  if you want to automate the GUI with AutoIt, I would push the install file to the local PCs before setting up the login script.  This should relieve the error that you were getting in your script from running it from a server.  Have the AutoIt script delete the install file after it has been installed.  

I hate old installers like this.  

 

Adam

Link to comment
Share on other sites

From running the installation, it uses Wise Installation Wizard, but it doesn't want to respond to any command line switches.  This looks like an old installer too.  You could try repackaging it with the AppDeploy Repackager.  

From running the installer, it does take quite some time, and has a lot of files.  if you want to automate the GUI with AutoIt, I would push the install file to the local PCs before setting up the login script.  This should relieve the error that you were getting in your script from running it from a server.  Have the AutoIt script delete the install file after it has been installed.  

I hate old installers like this.  

 

Adam

When you say "push the install file to the local PC's."  I would have to push both install files, correct?  the exe I created with AutoIT as well as the installer from the program's website, correct?  What is the easiest way to push the exe to everyone's computer?  And, is it necessary to delete the install file after it has been completed?  And what is the easiest way to have this done also?

Thanks for all your help.  I am impressed with the dedication here.  How can I repay you?

Link to comment
Share on other sites

So you have only have one file, I would do a FileInstall of the installation file in the installation script, and have a FileDelete after the installation.  You do not need to delete the install file, but as habit, I like to clean up after installations.  You can also have the installation script delete itself as well, look at guinness' >_SelfDelete() UDF if you would like to do this.  

To push the file, use a script that you run from your PC, or a server, reading PC names from a file, and loop through them copying the file.  Here is an example of one of my old push scripts to get you started.  

#include <File.au3>
#include <Array.au3>

Global $sPCNames = ""
Global $sFileRunLog = StringTrimRight(@ScriptFullPath, 4) & " Install Log.log"
Global $sFileToCopy = "specIT104.exe" ;Compiled Installation Script.
;~ Global $sFileToCopy = @ScriptFullPath ;For Testing.
Global $sRemoteFolder = "Temp" ;Folder in relation to the "C:\" without leading or trailing backslashes.

;Read PC Names From File.  One PC name per line.
Global $sPCNamesFile = "PCNames.txt"
Global $aPCNames
_FileReadToArray($sPCNamesFile, $aPCNames)
If @error Then
    _FileWriteLog($sFileRunLog, "ERROR: Unable to open " & $sPCNamesFile & " : _FileReadToArray @error: " & @error)
    Exit 1
EndIf
;~ _ArrayDisplay($aPCNames) ;For testing.
$sPCNames &= _ArrayToString($aPCNames, "|", 1) & "|"
ConsoleWrite($sPCNames & @LF)

;Check for Names Only Error File.
Global $sErrorNamesOnlyFileName = StringTrimRight(@ScriptFullPath, 4) & " Errors-Names only.log"
If FileExists($sErrorNamesOnlyFileName) Then
    Global $aErrorPCs
    Global $sErrorFileName = StringTrimRight(@ScriptFullPath, 4) & " Errors.log"
    Global $sErrorNamesOnlyFileNameOld = StringTrimRight($sErrorNamesOnlyFileName, 4) & "-old.log"
    Global $sErrorFileNameOld = StringTrimRight($sErrorFileName, 4) & "-old.log"

    _FileReadToArray($sErrorNamesOnlyFileName, $aErrorPCs)
    If @error Then
;~      MsgBox(16, "ERROR!", "Unable to open file.") ;For testing.
        _FileWriteLog($sFileRunLog, "ERROR: Unable to open error log file.  _FileReadToArray @error: " & @error)
        Exit 1
    EndIf
    
    ;Remove duplicate PC names.
    For $i = 0 To UBound($aErrorPCs) - 1 Step 1
        If StringInStr($sPCNames, $aErrorPCs[$i]) Then
            $sPCNames = StringReplace($sPCNames, $aErrorPCs[$i] & "|", "")
        EndIf
    Next
    
    If FileExists($sErrorNamesOnlyFileName) Then
        FileMove($sErrorNamesOnlyFileName, $sErrorNamesOnlyFileNameOld, 1)
        FileDelete($sErrorNamesOnlyFileName)
    EndIf
    If FileExists($sErrorFileName) Then
        FileMove($sErrorFileName, $sErrorFileNameOld, 1)
        FileDelete($sErrorFileName)
    EndIf
    Global $sErrorPCs = StringStripWS(_ArrayToString($aErrorPCs, "|", 1), 3)
    $sPCNames &= $sErrorPCs & "|" ;Append to PC Names list.
;~  $sPCNames = $sErrorPCs & "|" ;Replace PC Names list with error names.
EndIf

;Copy File.
If StringRight($sPCNames, 1) = "|" Then $sPCNames = StringTrimRight($sPCNames, 1)
$aPCNames = StringSplit($sPCNames, "|")
_ArraySort($aPCNames, 0, 1)
;~ _ArrayDisplay($aPCNames) ;For Testing.
Global $sTitle = "Copy Installation File"
ProgressOn($sTitle, "", "", -1, -1, 2 + 16)
;~ WinMove($sTitle, "", 60, 150)
;~ WinMove($sTitle, "", 1300, 150)
;~ WinMove($sTitle, "", 3050, 25)
Global $sPCName = ""
Global $fCopied = False
For $iPCNum = 1 To $aPCNames[0] Step 1
    $sPCName = $aPCNames[$iPCNum]
    ProgressSet(Round(($iPCNum / $aPCNames[0]) * 100), $iPCNum & " of " & $aPCNames[0], $sPCName)
    If FileCopy($sFileToCopy, "\\" & $sPCName & "\c$\" & $sRemoteFolder & "\", 1 + 8) Then
        $fCopied = True     
    Else
        $fCopied = False
        _WriteComputerErrorLog($sPCName, "Error Copying File: " & $sFileToCopy)
    EndIf
    _FileWriteLog($sFileRunLog, $sPCName & "  FileCopy : " & $fCopied)
    Sleep(25)
Next
ProgressOff()


; #FUNCTION# ====================================================================================================================
; Name...........: _WriteComputerErrorLog
; Description ...: Write 2 error logs: One contain the computer name with errors and another with the computer names only.
; Syntax.........: _WriteComputerErrorLog($sComputer[, $sErrorLogMessage = Default[, $sFileErrorLog = Default]])
; Parameters ....: $sComputer - Remote computer name
;                  $sErrorLogMessage - Optional: create a error log file with the message entered.
;                  |DEFAULT: (Default) log file not created.
;                  $sErrorLogFileName - Optional: the full path for saving the error log file.
; Return values .:
; Author ........: Adam Lawrence (AdamUL)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func _WriteComputerErrorLog($sComputer, $sErrorLogMessage = Default, $sFileErrorLog = Default)

    If Not IsString($sErrorLogMessage) Or $sErrorLogMessage = "" Then $sErrorLogMessage = "Script did not run."
    If $sFileErrorLog = Default Then $sFileErrorLog = StringTrimRight(@ScriptFullPath, 4) & " Errors.log"

    _FileWriteLog($sFileErrorLog, $sComputer & " : " & $sErrorLogMessage)
    Local $sFileNamesOnlyErrorLog = StringTrimRight($sFileErrorLog, 4) & "-Names only.log"
    Local $iFoundComputerName = 0

    If FileExists($sFileNamesOnlyErrorLog) Then
        Local $aComputerNames
        _FileReadToArray($sFileNamesOnlyErrorLog, $aComputerNames)
        For $iNameIndex = 1 To $aComputerNames[0] Step 1
            If StringInStr($aComputerNames[$iNameIndex], $sComputer) Then $iFoundComputerName += 1
        Next
    EndIf

    If Not $iFoundComputerName Then
        Local $hComputerNames = FileOpen($sFileNamesOnlyErrorLog, 1)
        FileWriteLine($hComputerNames, $sComputer)
        FileClose($hComputerNames)
    EndIf
EndFunc   ;==>_WriteComputerErrorLog 

You can repay by helping others on the forum, when you are able to.  

 

Adam

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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