Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Toggle Bluetooth using Quicksilver and AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Toggle Bluetooth using Quicksilver and AppleScript
Authored by: chally on Mar 30, '07 01:38:59PM
This script does, but you could use applescript to change it in the Bluetooth system preference. There are similar scripts posted, including one that turns the clock on and off. This is what I use for that, if it gives you an idea where to start:
-- This script tells the "Date & Time" preference pane to do the following:
--
-- if the clock is not showing in any way
-- or the clock is showing in the menu bar, then
--  Show the clock in the window the way I like it
-- else if the clock is showing in the window then
--  Show the clock in the menu bar the way I like it

tell application "System Preferences"
	activate
	set the current pane to pane "Date & Time"
	delay 1
end tell

tell application "System Events"
	tell process "System Preferences"
		-- define stuff
		set tabGroup to the first tab group of the window "Date & Time"
		set mainGroup to the first group of tabGroup
		set viewInRadioGroup to the first radio group of mainGroup
		set viewAsRadioGroup to the second radio group of mainGroup
		set showClockCheckbox to the checkbox 
			"Show the date and time" of mainGroup
		set showSecondsCheckbox to the checkbox 
			"Display the time with seconds" of mainGroup
		set showAmPmCheckbox to the checkbox 
			"Show AM/PM" of mainGroup
		set showDOWCheckbox to the checkbox 
			"Show the day of the week" of mainGroup
		set flashColonsCheckbox to the checkbox 
			"Flash the time separators" of mainGroup
		set twentyFourHourCheckbox to the checkbox 
			"Use a 24-hour clock" of mainGroup
		--do stuff
		if the value of showClockCheckbox is 0 then
			click showClockCheckbox
			set clockWasShowing to false
		else
			set clockWasShowing to true
		end if
		if the value of radio button "Window" of viewInRadioGroup is 0 
			or not clockWasShowing then
			click radio button "Clock" of tabGroup
			if the value of showClockCheckbox is 0 then 
				click showClockCheckbox
			click radio button "Window" of viewInRadioGroup
			click radio button "Analog" of viewAsRadioGroup
			if the value of showSecondsCheckbox is 0 then 
				click showSecondsCheckbox
		else
			click radio button "Clock" of tabGroup
			if the value of showClockCheckbox is 0 then 
				click showClockCheckbox
			click radio button "Menu Bar" of viewInRadioGroup
			click radio button "Digital" of viewAsRadioGroup
			if the value of showSecondsCheckbox is 1 then 
				click showSecondsCheckbox
			if the value of showAmPmCheckbox is 0 then 
				click showAmPmCheckbox
			if the value of showDOWCheckbox is 0 then 
				click showDOWCheckbox
			if the value of flashColonsCheckbox is 1 then 
				click flashColonsCheckbox
			if the value of twentyFourHourCheckbox is 1 then 
				click twentyFourHourCheckbox
		end if
		set visible to false
	end tell
end tell


[ Reply to This | # ]