Re: Dashboard script needs some help
Re: Dashboard script needs some help
- Subject: Re: Dashboard script needs some help
- From: Steve Thompson <email@hidden>
- Date: Fri, 23 Jul 2010 11:41:31 +0100
I have a little script that turns Dashboard on or off. I'm not sure how to set it up correctly so that when a button is pushed the appropriate action follows
I'd do it by checking what it's currently set to -
try set current_value to do shell script ("defaults read com.apple.dashboard mcx-disabled") on error -- if mcx-disabled has never been set, you get an error instead of a number. However, if mcx-disabled -- is unset then the dashboard is probably enabled, so we'll set this to 1. set current_value to 1 end try
display dialog "The Dashboard is currently " & item (current_value + 1) of {"disabled", "enabled"} & ". Click OK to " & item (current_value + 1) of {"enable", "disable"} & " it."
--If we run this, user didn't click cancel - we just set it to the opposite value of it's current setting
set new_value to item (current_value + 1) of {"YES", "NO"}
do shell script "defaults write com.apple.dashboard mcx-disabled -boolean " & new_value & " && killall Dock"
Steve |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden