Jan 242011
 

How To Automate an Installation with AutoIt:

When Silent installation switches fail, and re-packaging the installation is not an option, then AutoIt is the best tool for the job. It can easily mimic any manual input performed during installations. I listed some quick tips below, but I strongly urge you to review the help documentation included in AutoIt.

  1. On a clean machine, preferably a Virtual Machine (With Snapshot support), install the latest AutoIt application.
    http://www.autoitscript.com/autoit3/downloads.shtml
  2. Open the “AutoIt Window Info” Tool.
    clip_image002[4]
  3. With the “AutoIt Window..” open, initiate the application install that you wish to build a silent installation for.
    ( In my example, I initiated a Daemon Tools Lite installation DTLite4402-0131.exe)
  4. Once initiated, before clicking or entering the desired input, capture the button “control” properties using the “crosshair” tool in the “AutoIt Window..” application. In particular, capture the button’s “ID”, if that is not available, capture the “Advanced (Class)” value.
  5. Also capture the “Title” of the Window and some “Visible Text” displayed in the Dialog box. This can be centrally captured from the “Summary” tab in the “AutoIt Window..” application.
    clip_image004[4]
  6. Toggle through all dialog boxes capturing the details needed to automate the tasks and build a log of all screens captured:
    clip_image006
  7. In some cases, sub windows or checkbox selections can not be targeted with the “AutoIt Window..” crosshair. In those times, use keyboard actions to populate the desired options and record them.
    clip_image008
    clip_image010
  8. After all information is collected, open the “SciTE Script Editor”
    clip_image012
  9. Populate a block of code to call the installer (replace *.exe):

$InstallPath = @ScriptDir & "\DTLite4402-0131.exe"

;Run Adobe Install from Currecnt Dir.
If FileExists($InstallPath) Then
  Run($InstallPath)
Else
 
MsgBox(4096, $InstallPath, "File: " & $InstallPath & " does NOT exists")
  Exit
EndIf

Now enter a block of code for each dialog box:
Example of single button click:

WinWaitActive("DAEMON Tools Lite", "Please select language.")
;Click on OK for English
ControlClick("DAEMON Tools Lite", "", 1)

Example of two button clicks in one dialog:

WinWaitActive("DAEMON Tools Lite", "Please choose the License type you prefer.")
;Select "Free License" type
ControlClick("DAEMON Tools Lite", "", 1202)
;Click on Next
ControlClick("DAEMON Tools Lite", "", 1)


Example of sending keyboard keys to dialog box:

WinWaitActive("DAEMON Tools Lite", "Choose which features of DAEMON Tools Lite you want to install.")

;Select desired features.
SendKeepActive("DAEMON Tools Lite")

For $i = 1 to 3
 
Sleep(500)
  Send("{TAB}")
Next

For $i = 1 to 7
 
Sleep(500)
Send("{DOWN}")
Send("{SPACE}")
Next
ControlClick("DAEMON Tools Lite", "", 1)

  1. Compile your code by clicking on “Compile” from the Tools menu.
  2. This is where VM Snapshots comes into handy, you can simply revert to a state prior to the install and test your compiled code. Otherwise, you must perform un-installations of the application between tests.
  3. I’ve attached an example .au3 file used for the silent installation of Daemon Tools Lite.  Also, reference AutoIt’s Help Documentation for more information.
    http://dl.dropbox.com/u/475584/Imaging/Scripts/DLiteSilentInstallation.au3
Share

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>