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


Click here to return to the 'Workaround for Leopard' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Workaround for Leopard
Authored by: ccjensen on Nov 26, '08 12:59:31PM
figured I would throw in my solution which was based upon the original post.
on run argv
if length of argv is not 1 then
return
end if

set switch to item 1 of argv as string

tell application "System Events" to tell the front menu bar of process "SystemUIServer"
set menu_extras to value of attribute "AXDescription" of menu bar items
repeat with x from 1 to the length of menu_extras
if item x of menu_extras is "bluetooth" then exit repeat
end repeat
tell menu bar item x
click
tell 2nd menu item of front menu
if name ends with switch then
set clicked to true
click
else
set clicked to false
end if
end tell
if not clicked then
click
end if
end tell
end tell
end run
This code takes a single argument: the desired action (ie On or Off)

It would be run from the terminal:
osascript /path/to/script/name_of_script_file.scpt On
osascript /path/to/script/name_of_script_file.scpt Off


[ Reply to This | # ]