A Script to Install Acrobat Reader 7

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

A Script to Install Acrobat Reader 7

Post by Marcus Tettmar » Tue Jul 04, 2006 8:54 am

This script automates the installation of Adobe Reader 7.0.8. This script uses FindWindowWithText to detect the different setup screens as the title of these remains the same but only the content changes. Use the View System Windows tool to determine the text that can be detected. Further notes in the comments of the script.

Code: Select all

/*
 Adobe Reader Installer
 Written for Adobe Reader 7.0.8.  May need tweaking for a different version!
 
 Download the full installer for Adobe Reader 7.0.8 from:
 http://ardownload.adobe.com/pub/adobe/reader/win/7x/7.0.8/enu/AdbeRdr708_en_US.exe

 Ensure Adobe Reader is NOT already installed before running this
 
 Modify line 31 to suit path to installer
 
 How this works:
 Because all the setup windows have the same title I have used some simple loops
 with the FindWindowWithText command to detect the changing messages _within_ the
 setup windows.  This means there are no fixed wait times to ensure this will
 run generically regardless of the speed of the environment etc. 
 
 Note that some installers offer a quiet install mode using the /qn switch.  This doesn't
 appear to work with Adobe Reader.  If it did we'd only need one or two lines of code!
*/

//Path to installer file
Let>Installer=D:\AdbeRdr708_en_US.exe

//Title of installer - will be different per version
Let>InstallTitle=Adobe Reader 7.0.8 - Setup

//Run installer
Run>%Installer%

//Wait for installer window to appear
WaitWindowOpen>%InstallTitle%
SetFocus>%InstallTitle%

//Wait for initial Splash screen then Press Enter (Next is default)
Let>title=
Label>WaitSplash
  //Spelling mistake is intentional - the label is spelled incorrectly on install screen
  FindWindowWithText>ReaderSpalsh,0,title
  If>%title%<>%InstallTitle%,WaitSplash
SetFocus>%InstallTitle%
Press Enter

//Wait for Welcome message
Let>title=
Label>WaitWelcome
  FindWindowWithText>Welcome to Setup for Adobe Reader,0,title
  If>%title%<>%InstallTitle%,WaitWelcome
SetFocus>%InstallTitle%
Press Enter

//Wait for Destination Folder message
Let>title=
Label>WaitDestination
  FindWindowWithText>Destination Folder,0,title
  If>%title%<>%InstallTitle%,WaitDestination
SetFocus>%InstallTitle%
Press Enter

//Wait for Ready to Install message
Let>title=
Label>WaitInstallReady
  FindWindowWithText>Ready to Install the Program,0,title
  If>%title%<>%InstallTitle%,WaitInstallReady
SetFocus>%InstallTitle%
Press Enter

//Wait for Setup Completed
Let>title=
Label>WaitCompleted
  FindWindowWithText>Setup Completed,0,title
  If>%title%<>%InstallTitle%,WaitCompleted

//Press final Finish button
SetFocus>%InstallTitle%
Press Enter
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts