Go Back   The macosxhints Forums > OS X Help Requests > System



Reply
 
Thread Tools Rate Thread Display Modes
Old 12-09-2009, 01:23 PM   #1
rasmusjv
Prospect
 
Join Date: Dec 2009
Posts: 3
Question Wifi ON/OFF with Keyboard Shortcuts

Hi,

Is it somehow possible to make a keyboard combo/shortcut to turn the Wifi ON/OFF? I would like to have this working on my Snow Leopard MB Pro. I can't find a valid solution for this using Google or any other search tool. Please help me out.

Br

RasmusJV, Denmark
rasmusjv is offline   Reply With Quote
Old 12-09-2009, 02:57 PM   #2
anika123
All Star
 
Join Date: Sep 2006
Posts: 860
You do know you can turn the airport off by clicking the icon in the menu bar, right? Click wifi icon and select "turn airport off"
__________________
Snow Leopard 10.6, MacBookPro1,1
anika123 is offline   Reply With Quote
Old 12-09-2009, 03:27 PM   #3
NaOH
Hall of Famer
 
Join Date: Dec 2007
Posts: 3,840
Along the lines of anika123's comment, with something like Butler or Spark (there are others, but those are free) to assign keyboard shortcuts to scripts, this script will work if the Airport Menu Extra (in the menubar) is the first item to the left of the clock.

Code:
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 "time machine menu extra" then exit repeat
	end repeat
	tell menu bar item 2
		click
		delay 0.5
		click 2nd menu item of front menu
		delay 0.5
	end tell
end tell
NaOH is offline   Reply With Quote
Old 12-09-2009, 03:38 PM   #4
rasmusjv
Prospect
 
Join Date: Dec 2009
Posts: 3
Quote:
Originally Posted by NaOH
Along the lines of anika123's comment, with something like Butler or Spark (there are others, but those are free) to assign keyboard shortcuts to scripts, this script will work if the Airport Menu Extra (in the menubar) is the first item to the left of the clock.

Code:
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 "time machine menu extra" then exit repeat
	end repeat
	tell menu bar item 2
		click
		delay 0.5
		click 2nd menu item of front menu
		delay 0.5
	end tell
end tell

No, mine is number 3 from the clock.

- RasmusJV

PS. Can I just change the item 2 to item 3 instead?
rasmusjv is offline   Reply With Quote
Old 12-09-2009, 03:42 PM   #5
NaOH
Hall of Famer
 
Join Date: Dec 2007
Posts: 3,840
I'm never certain, and for things like this I just experiment until the script does what I want. I would suggest you copy and paste the script into AppleScript editor. Change the number, select Run at the top of the AppleScript window, then see if it works.
NaOH is offline   Reply With Quote
Old 12-09-2009, 03:44 PM   #6
rasmusjv
Prospect
 
Join Date: Dec 2009
Posts: 3
Thanks, got it working with your script! Awesome!

- RasmusJV
rasmusjv is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Forum Jump



All times are GMT -5. The time now is 03:32 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.