Hi all,
The attached script installed Flip4Mac onto the users computer. We thought we had this sussed but for some reason it is intermittently not closing. Can anyone see any obvious faults or ways to improve it? We’ve added a few if statements that deal with installing on a 10.5 and 10.6 machine.
Thanks in advance.
Will
property Flip4MacWindow : "Install Flip4Mac WMV"
set Flip4MacPath to POSIX path of (path to desktop) & "Flip4Mac/installer/Flip4Mac WMV.mpkg" -- Opens the installer on the user's desktop
tell application "Finder"
do shell script "open " & quoted form of Flip4MacPath
tell application "System Events"
tell process "Installer"
delay 2
-- Initial popup window (This package will run a program to determine if the software can be installed.)
click button "Continue" of window 1
delay 0.5
-- Welcome window
my waitForTextAndClickButton("Welcome to", "Continue")
delay 0.5
-- Important Information window
my waitForTextAndClickButton("Important Information", "Continue")
delay 0.5
-- Software License window
my waitForTextAndClickButton("Software License Agreement", "Continue")
delay 0.5
click button "Agree" of sheet 1 of window Flip4MacWindow
delay 0.5
-- Install destination window that appears sometimes (usually after an initial system boot)
if value of static text 1 of window Flip4MacWindow is equal to "Select a Destination" then
delay 0.5
click button "Continue"
else if value of static text 1 of window Flip4MacWindow is equal to "Standard Install on "Macintosh HD"" then
-- License Agreement drop down
my waitForTextAndClickButton("Standard Install", "Install")
end if
delay 2
keystroke (ASCII character of 13) -- Return keystroke on the password field
tell window "Install Flip4Mac WMV"
-- Waiting for install process to complete and which of the 2 windows will appear as to what to continue with to finish
repeat until value of static text 1 is equal to "The installation was completed successfully." or value of static text 1 is equal to "Installation completed successfully" or value of static text 1 is equal to "Flip4Mac WMV Upgrade"
delay 0.1
end repeat
-- This handles a 10.6 installation
if value of static text 1 is equal to "The installation was completed successfully." then
delay 2
my waitForTextAndClickButton("The installation was", "Close")
-- This handles a 10.5 installation
else if value of static text 1 is equal to "Installation completed successfully" then
delay 2
my waitForTextAndClickButton("Installation completed", "Close")
else if value of static text 1 is equal to "Flip4Mac WMV Upgrade" then
delay 2
my waitForTextAndClickButton("Flip4Mac", "Continue")
delay 2
-- This handles a 10.6 installation
if value of static text 1 is equal to "The installation was completed successfully." then
delay 2
my waitForTextAndClickButton("The installation was", "Close")
-- This handles a 10.5 installation
else if value of static text 1 is equal to "Installation completed successfully" then
delay 2
my waitForTextAndClickButton("Installation completed", "Close")
delay 2
end if
end if
tell current application
say "Flip 4 Mac installation completed successfully" using "Trinoids"
end tell
end tell
end tell
end tell
end tell
-- This is the function
on waitForTextAndClickButton(theText, theButton)
tell application "System Events"
tell process "Installer"
tell window Flip4MacWindow
repeat until value of static text 1 begins with theText
delay 0.1
end repeat
delay 2
click button theButton
end tell
end tell
end tell
end waitForTextAndClickButton