New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

applescript and administrator password...help!


Post Reply New Thread Subscribe

 
Thread Tools
NewbieStu

 
Member Since: Dec 30, 2011
Posts: 3
NewbieStu is on a distinguished road

NewbieStu is offline
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
QUOTE Thanks
NewbieStu

 
Member Since: Dec 30, 2011
Posts: 3
NewbieStu is on a distinguished road

NewbieStu is offline
I've solved this problem. Sorry to bother.
QUOTE Thanks

Post Reply New Thread Subscribe


« Python module import error | Installed xtools followed all recommendations but make still doesn't work »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

All times are GMT -4. The time now is 11:52 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?