Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Laser47

macrumors 6502a
Original poster
Jan 8, 2004
856
0
Maryland
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



By the way it is a script to remove classic
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Wrap the problem statements in try - on error -end try blocks:
Code:
try
do some bad thing
on error
display dialog "error"
end try
 

Laser47

macrumors 6502a
Original poster
Jan 8, 2004
856
0
Maryland
thanks, it worked. Im almost dont the script, just need to install classic and see if it works.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.