applescript and administrator password...help!

Joined
Dec 30, 2011
Messages
3
Reaction score
0
Points
1
I am an Applescript newbie. I wrote the following script to create a folder in MacHD>Library>Applications Support which is now write-protected in Lion (a change from Snow Leopard). It works fine, creating the folder if one of that name is not already there, skipping if folder already exists, asking for an administrator password on the way (no prob). The problem arises if the user cancels the request for the administrator password. Another request pops up, If this is canceled the script completes as if the folder had been created. How can I trap the Cancel command and cancel the whole script? Many, many thanks.

Script:

tell application "Finder"
activate
try
make new folder at folder "Application Support" of folder "Library" of startup disk with properties {name:"foldername"}
end try
display dialog "The missing folder has been successfully installed." buttons {"OK"} default button 1
end tell
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top