• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dashboard script needs some help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


On 22 Jul 2010, at 17:55, email@hidden wrote:

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

References: 
 >Dashboard script needs some help (From: email@hidden)

  • Prev by Date: Re: NoteTaker script - help needed
  • Next by Date: Re: AppleScripts and Apache
  • Previous by thread: Re: Dashboard script needs some help
  • Next by thread: Re: AppleScripts and Apache
  • Index(es):
    • Date
    • Thread