29 November 2012

Stepping through an installation with AutoIT

Posted By: Mick Pletcher - 3:13 PM

Share

& Comment

Programs such as trial versions of Autodesk and Adobe CS6 cannot be packaged up for distribution. You may be put in a situation where you need to deploy a trial version out to a set of users for them to evaluate it. The traditional packaging programs are not going to work here because of the licensing issue. Here is how to use AutoIT to deploy them.

You will want to first step through the program documenting every keystroke required, from start to finish. You do not want to use your mouse. Next, Open up AutoIT. The first thing you will want to do is initiate the installation with the simple Run command. Next, use the WinWait command to wait for the first screen to appear. You will see the title of the window at the top left bar. Use the WinActivate to make sure that window is at the forefront. There are now two ways to proceed to the next page if the window title does not change. I use the WinSetTitle command to change the title of the window. When the next window appears, the title usually changes back to the default, Which is what you next set the WinWait to wait for. If the name does not change on the next page, then you will be forced to guesstimate the time it will take to proceed to the next page on the slowest system you have. Another important thing to remember is to use the Sleep command between each command because the script can go faster than the program is executing, therefor becoming asynchronous, thereby causing the installation script to go in a permanent pause state. I usually use 500 milliseconds, which seems to always be sufficient. Another important thing to do is comment between each screen in the script. That way, you will know where the script is between each window.

Here is an example of an installation script for Autodesk I wrote:




 ; Execute Civil 3D  
 Run( "setup.exe", "\\global.gsp\data\clients\na_clients\Autodesk\2012\CIV3D\64bit\AdminImage" )  
 ;  
 ;Initial Page  
 WinWait( "AutoCAD Civil 3D 2012" )  
 WinActivate( "AutoCAD Civil 3D 2012" )  
 WinSetTitle( "AutoCAD Civil 3D 2012", "", "Initial Page" )  
 WinActivate( "Initial Page" )  
 Send( "{ENTER}" )  
 ;  
 ;License Agreement  
 WinWait( "AutoCAD Civil 3D 2012" )  
 WinSetTitle( "AutoCAD Civil 3D 2012", "", "License Agreement" )  
 WinActivate( "License Agreement" )  
 Send( "{RIGHT}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{ENTER}" )  
 ;  
 ;Product Information  
 WinWait( "AutoCAD Civil 3D 2012" )  
 WinSetTitle( "AutoCAD Civil 3D 2012", "", "Product Information" )  
 WinActivate( "Product Information" )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{UP}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{TAB}" )  
 Sleep( 500 )  
 Send( "{ENTER}" )  
 ;  
 ;Configure Installation  
 WinWait( "AutoCAD Civil 3D 2012" )  
 WinSetTitle( "AutoCAD Civil 3D 2012", "", "Configure Installation" )  
 WinActivate( "Configure Installation" )  
 Send( "{ENTER}" )  
 ;  
 ;Installing  
 WinWait( "AutoCAD Civil 3D 2012" )  
 WinSetTitle( "AutoCAD Civil 3D 2012", "", "Installation" )  
 WinActivate( "Installation" )  
 ;  
 ;Finish  
 WinWait( "AutoCAD Civil 3D 2012" )  
 WinActivate( "AutoCAD Civil 3D 2012" )  
 Sleep( 500 )  
 Send( "{ENTER}" )  
 Sleep( 500 )  

About Mick Pletcher

My blog is here to help solve issues I have encountered and solved, publish scripts I have written, and educate others in understanding areas that are not well covered

0 comments:

Post a Comment

Copyright © 2013 Mick's IT Blogs™ is a registered trademark.