-- The following two lines should be automatically prepended to the file when running make: -- set my_ID to "no.samediggi.divvun.msoffice.2011.proofingtools.pkg" -- set my_Title to "Divvun for MS Office 2011" -- set InstDir to "/Library/DivvunTools/MSOffice2004" set uninstaller_script to POSIX path of (path to me) & ¬ "Contents/Resources/uninstall.pl" set fix_uninstaller_path to "echo " & uninstaller_script & " | sed -e 's/ /\\\\ /g'" set fixed_uninstaller to do shell script fix_uninstaller_path display dialog fixed_uninstaller set my_shell_script to (quoted form of fixed_uninstaller) & " " & my_ID & " " & ¬ quoted form of InstDir display dialog my_shell_script display dialog (localized string of "Are you sure you want to uninstall:") & ¬ return & return & my_Title ¬ buttons {{localized string of "Cancel"}, {localized string of "Uninstall"}} ¬ default button 2 try do shell script quoted form of uninstaller_script with administrator privileges tell application "Finder" activate display dialog (localized string of "Finished uninstallation of") ¬ & return & return & my_Title buttons {localized string of "OK"} end tell on error errText number errNum if (errNum is equal to -128) then -- User cancelled, do nothing. else tell application "Finder" activate display dialog ¬ my_Title & ":" & ¬ (localized string of "Uninstallation failed.") & ¬ return & return & ¬ (localized string of "Cause:") & return & errText buttons {localized string of "OK"} end tell end if end try