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



Reply
 
Thread Tools Rate Thread Display Modes
Old 08-16-2008, 08:23 AM   #1
blubbernaut
MVP
 
Join Date: Sep 2003
Posts: 1,856
Schedule wireless on Airport Extreme

This may seem like an odd request...

I'm wondering if there is any way to script (Applescript, Terminal, Automator or other) a schedule to turn the wireless setting in Airport Utility on or off at a set time?
blubbernaut is offline   Reply With Quote
Old 08-16-2008, 12:09 PM   #2
NovaScotian
Hall of Famer
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,945
I assume you mean without losing its wired connectivity. Otherwise, just turn it off with a timer?
__________________
17" MBP, OS X 10.8.3; 27" iMac, OS X 10.8.3
NovaScotian is offline   Reply With Quote
Old 08-16-2008, 07:48 PM   #3
blubbernaut
MVP
 
Join Date: Sep 2003
Posts: 1,856
Ah! Yes unfortunately I do mean with maintaining wired connectivity...otherwise what a brilliant lo-tech solution!
blubbernaut is offline   Reply With Quote
Old 08-16-2008, 09:01 PM   #4
NovaScotian
Hall of Famer
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,945
You can turn the wireless portion off. I couldn't get this to take the last step:

Code:
launch application "AirPort Utility"
delay 3
tell application "System Events"
	tell process "AirPort Utility"
		activate
		tell window 1
			click button 5
			delay 3
			tell tab group 1
				click radio button 3
				delay 3
				tell menu of pop up button 1
					delay 1
					click menu item "Off"
				end tell
			end tell
		end tell
	end tell
end tell
It got to the right place, but didn't activate the drop down menu containing "Off".
__________________
17" MBP, OS X 10.8.3; 27" iMac, OS X 10.8.3
NovaScotian is offline   Reply With Quote
Old 08-17-2008, 02:42 AM   #5
blubbernaut
MVP
 
Join Date: Sep 2003
Posts: 1,856
You are awesome! I understand enough to unpick a little bit of applescript, but not enough to start one up myself.

Here's what I worked out was missing:

Code:
launch application "AirPort Utility"
delay 5
tell application "System Events"
	tell process "AirPort Utility"
		activate
		tell window 1
			click button 5
			delay 10
			tell tab group 1
				click radio button 3
				delay 3
				click pop up button 1
				tell menu of pop up button 1
					delay 1
					click menu item "Off"
				end tell
			end tell
		end tell
	end tell
end tell
We just needed to "click" the pop up button first then tell it to choose "off".
That's really great, much appreciated. Now all I've got to do is get it to happen at a specific time!
blubbernaut is offline   Reply With Quote
Old 08-17-2008, 09:01 AM   #6
NovaScotian
Hall of Famer
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,945
Thanks for the discovery -- it was getting late and I couldn't see what was wrong with that. By the way, you can probably reduce the delay times; I always set them long to be sure the last step has finished before the next event command.

With respect to scheduling this to happen at a specific time, you either need third-party software to do it, or you need to learn about launchd, the OS X method for scheduling events.
__________________
17" MBP, OS X 10.8.3; 27" iMac, OS X 10.8.3
NovaScotian is offline   Reply With Quote
Old 08-17-2008, 09:24 AM   #7
idsamdg
Prospect
 
Join Date: May 2008
Location: Leeds, UK
Posts: 35
Quote:
Originally Posted by NovaScotian
You can turn the wireless portion off. I couldn't get this to take the last step:

Code:
launch application "AirPort Utility"
delay 3
tell application "System Events"
	tell process "AirPort Utility"
		activate
		tell window 1
			click button 5
			delay 3
			tell tab group 1
				click radio button 3
				delay 3
				tell menu of pop up button 1
					delay 1
					click menu item "Off"
				end tell
			end tell
		end tell
	end tell
end tell
It got to the right place, but didn't activate the drop down menu containing "Off".

I wish I was clever enough to understand what any of that meant.
__________________
"When injustice becomes law, resistance becomes duty."
idsamdg is offline   Reply With Quote
Old 08-17-2008, 09:42 AM   #8
NovaScotian
Hall of Famer
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,945
It's not a matter of clever. I own a piece of software called UI Browser that exposes how the GUI of an application works, i.e., what it's elements (objects) are called and "who" they belong to in the object model of the software. Background software (always running) called System Events controls the interactions between software running on your Mac and the windows it presents to you. When you do something to an interface object, System Events transmits this to the application to "inform" it of your change. The code above is a way to have an AppleScript send those same events to the application GUI objects as if you had done them to the user interface.
__________________
17" MBP, OS X 10.8.3; 27" iMac, OS X 10.8.3

Last edited by NovaScotian; 08-17-2008 at 09:49 AM.
NovaScotian 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 11:33 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, 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.