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

10.5: An AppleScript to restart an AirPort Base Station Network
After reading my Airtunes hint, several people have asked me to post a script to restart an AirPort Base Station ... so here it is. The script assumes you can at least see the Base Station in AirPort Utility, which is not always the case so YMMV. You can use the launchd utility or Cronnix if you prefer to schedule it. If you have a shell script for this, please share as I think that would be a more elegant solution.

Meanwhile, here's the AppleScript: [robg adds: I haven't tested this one.]
    •    
  • Currently 2.14 / 5
  You rated: 5 / 5 (7 votes cast)
 
[19,443 views]  

10.5: An AppleScript to restart an AirPort Base Station | 11 comments | Create New Account
Click here to return to the '10.5: An AppleScript to restart an AirPort Base Station' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: An AppleScript to restart an AirPort Base Station
Authored by: Lutin on Jan 05, '08 12:16:41PM

Tested.

It works fine, and will be convenient.

Thank you.



[ Reply to This | # ]
Script for Tiger
Authored by: leamanc on Jan 05, '08 10:19:58PM

You mention there is a different script for Tiger. Do you have a website where it is available, or can you post it in the comments here?



[ Reply to This | # ]
Script for Tiger
Authored by: MeIr on Feb 18, '08 09:41:20AM

I tested, works on Tiger just fine.
No need for any modifications.



[ Reply to This | # ]
10.5: An AppleScript to restart an AirPort Base Station
Authored by: BCooper202 on Jan 06, '08 05:22:08AM

I have two airport stations in my house: an Airport Extreme (named "Airport Bedroom") and an Airport Express (named "Express - Living Room"). When Airport Utility is launched, Airport Bedroom shows at the top of the list, and Express - Living Room is second.

The script works fine in selecting the first one to show in the list: Airport Bedroom.

But when I duplicated the script and tried to tweak it to pick the second it doesn't work -- always picks the first of the two in the list.

The tweak I did was in the line tell window 1 --"AirPort Utility - Extreme Base" -- I changed "Extreme Base" to "Express - Living Room".

But it still picks the Airport Bedroom at the top of Airport Utility's list.

Any clues as to how to fix?



[ Reply to This | # ]
10.5: An AppleScript to restart an AirPort Base Station
Authored by: sweyhrich on Jan 06, '08 08:18:02AM
I found it necessary to make a couple of adjustments (sorry, don't have a solution to the problem of selecting which base station). If it happens that Airport Utility is already open, and the Manual Setup has already been selected, I had the script fail with an error. Instead of these lines:

tell window 1
    click button "Manual Setup"

I replaced them with these lines:

tell menu bar item "Base Station"
    tell menu 1
        click menu item "Manual Setup"
        delay 10
    end tell
end tell

I also increased the delay after activating the script to delay 10, and the delay after "say 'Restarting Airport'" to 5, which works better with my setup. Great script! My airport base station seems to disappear from my laptop after a couple of days, making printing wirelessly impossible to the printer attached to the wired computer connected to the ethernet on the base station. Restarting the station fixes it, so I've got the "Restart Airport" script set to automatically run every morning at 2 am.

---
Steven Weyhrich
http://apple2history.org

[ Reply to This | # ]

10.5: An AppleScript to restart an AirPort Base Station
Authored by: Anonymous on Jan 06, '08 02:58:03PM

This script worked as described for me.

I find that my USB Air Disk I have hooked up has been inconsistent in its function.
I frequently lose the ability to Log in to the password protected disc. Rebooting has been the only solution.
The disc can always mount as a guest user.
This happens enough that I made this script an application that I assigned a HotKey with Quicksilver.

Any suggestions other than rebooting?



[ Reply to This | # ]
10.5: An AppleScript to restart an AirPort Base Station
Authored by: u2mr2os2 on Jan 08, '08 09:23:23AM

I think this hint assumes that you have saved your base station password in your keychain so that the Airport Utility does not prompt for a password.



[ Reply to This | # ]
10.5: An AppleScript to restart an AirPort Base Station
Authored by: Schwie on Feb 18, '08 11:21:06AM
I had to check the box "Enable access for assistive devices" in the "Universal Access" System Preference before this would work. Very slick and I like the audio feedback after the script has run :)

Brad

[ Reply to This | # ]

10.5: An AppleScript to restart an AirPort Base Station
Authored by: Schwie on Apr 21, '08 11:31:48AM

Actually, just to clarify... My applescript would never launch with cron, because my screensaver always interfered and something with user permissions too. Rather than figure out how to simulate a mouse click and resolve the permissions issue, I ended up just having iCal do it for me and everything was peachy.



[ Reply to This | # ]
10.5: An AppleScript to restart an AirPort Base Station
Authored by: gettes on Mar 11, '10 07:44:45PM
here is some code to help find the airport device your are interested in restarting in the list... apply to your taste...
tell application "AirPort Utility" to activate
tell application "System Events"
	tell application process "AirPort Utility"
		try
			repeat with n in {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
				set theThing to value of text field 1 of row n of table 1 of scroll area 1 of window 1
				log theThing
                                -- call a restart routine here - click this row first
			end repeat
			
		on error from obj to newClass
			log {"end of list:", obj, newClass} -- Display from and to info in log window.
		end try
	end tell
end tell
have fun!

[ Reply to This | # ]
10.5: An AppleScript to restart an AirPort Base Station
Authored by: AppleTablet on Mar 12, '10 10:36:24AM
Apple Script works just great. Thanks for sharing.

[ Reply to This | # ]