PDA

View Full Version : Ignore applescript errors from terminal




Laser47
Oct 28, 2005, 11:37 PM
Im pretty new to applescript and ive been trying to write a script that deletes a folder using terminal using administrative privlages. The thing im writing this script for another computer so i dont have the folder on it that i want it to delete. Is there a way i can tell applescript if it gets an error to ignore it and continue.
Here is the script, bear in mind im new to applescript
tell application "Terminal"
activate
do shell script "sudo rm -rf 'System Folder'" password pass with administrator privileges

do shell script "echo " & "$ sudo bless -folder ~/System/Library/CoreServices" password pass with administrator privileges
do shell script "echo " & "$ rm ~/Library/Preferences/ByHost/com.apple.Classic.some_number.plist" password pass with administrator privileges

do shell script "$ rm ~/Library/Preferences/com.apple.Classic.plist" password pass with administrator privileges

do shell script "$ rm ~/Library/Classic/.LoadClassicPref" password pass with administrator privileges

do shell script "$ rm ~/Library/Classic" password pass with administrator privileges

do shell script "$ sudo bless -folder /System/Library/CoreServices" password pass with administrator privileges



[COLOR="Red"]By the way it is a script to remove classic



robbieduncan
Oct 29, 2005, 04:03 AM
Wrap the problem statements in try - on error -end try blocks:

try
do some bad thing
on error
display dialog "error"
end try

Laser47
Oct 29, 2005, 10:25 AM
thanks, it worked. Im almost dont the script, just need to install classic and see if it works.