Windows Script Host

Some applications cannot be automated with command-line options These applications might provide a wizard-based setup routine but require the user to click buttons or press keys on the keyboard to install the application. If a user can complete the installation by using only the keyboard, you can automate the installation by creating a script (a series of text commands) that simulates keystrokes . This technique is called screen scraping.

You can screen scrape by using Windows Script Host . Specifically, you use the SendKeys() method to send keystrokes to an application. For more information about the SendKeys() method and an example that you can use to quickly create your own screen-scraping scripts, see

ON THE COMPANION MEDIA The companion media contains the sample script Sendkeys.vbs, which provides a shell for using the SendKeys() method without having to write your own script. It accepts two command-line options: sendkeys.vbs program textfile, where program is the path and file name of the program you want to drive, and textfile is the path and file name of the text file containing the keystrokes, one keystroke per line, to send to the program. See /en-us/library/8c6yea83.aspx for a list of key codes. If you need to pause before sending more keystrokes, add a line to the file that contains sleep. Each line that contains sleep will pause for 1 second. The file Sendkeys.txt is a sample textfile you can use with Sendkeys.vbs; for example, type sendkeys.vbs notepad.exe sendkeys.txt and watch what happens.

Repackaging Legacy Applications

Some legacy installers don't support silent installations, and some that do support silent installations don't provide a way to script settings. No legacy installers provide the management capabilities that Windows Installer provides .

If you have an application that is not designed for Windows Installer and does not support another automated installation technique, you can repackage it into the Windows Installer setup database so that you can use the features of Windows Installer to distribute and manage the application . A repackaged application combines the entire feature set of the application into a single feature . After repackaging an application, you use Windows Installer to install it . However, repackaged applications lack the flexibility to customize the application installation efficiently.

WARNING Do not repackage Microsoft Office. The Office package files include logic that customizes the installation for the destination computer and user. Repackaging the package file loses this logic, potentially preventing the package from installing correctly in some configurations.

Was this article helpful?

0 0

Post a comment