AppleScript C Perl Shell Xcode Other

Reboot Time Capsule with Applescript

Post Reply
coding / applescript     Views: 531Prev .. Next
Reboot Time Capsule with ApplescriptPosted: Thursday, May 8, 2014 [16:27:47] - 1
rootPosted by:rootMember Since:
June 16 2010
Posts: 356
Eventually network gets slow if Time Capsule is used as a router besides being Time Machine.
Rebooting it by disconnecting power cord is not too good for the Hand Drive.
To reboot it on a schedule is easy enough using either daemon or cron-like jobs with AppleScrip but different scripts used for different versions of AirPort Utility.

AppleScript for AirPort Utility v 6.2
View Codeactivate application "AirPort Utility"
-- once seems not to be enough
activate application "AirPort Utility"
delay 1 -- depends on a computer speed
tell application "System Events"
perform action "AXPress" of image 3 of group 1 of scroll area 1 of window 1 of application process "AirPort Utility"
-- image 2 for the first Airport station, 3 for the second and so-on
delay 4 -- wait for the data to be loaded, 4 seconds seems to be enough but check if it works
click menu item 3 of menu "Base Station" of menu bar 1 of process "AirPort Utility"
-- clicks on "Reboot..." item
delay 2 -- adjust accordingly
tell application "AirPort Utility" to quit -- we're all done - quit AirPort Utility
end tell


AppleScript for AirPort Utility v 5.6.1
View Codeactivate application "AirPort Utility"
-- once seems not to be enough
activate application "AirPort Utility"
delay 2
tell application "System Events"
-- use key code 125 (arrow down) if more than one AirPort station in AirPort Utility window. Default: first station selected, scroll down for your station
-- this code selects second station in the list
tell process "AirPort Utility"
key code 125
delay 3
end tell
-- clicks on "Reboot..." item
click menu item 6 of menu "Base Station" of menu bar 1 of process "AirPort Utility"
delay 6
-- if confirmation window pops-up we select and click on "OK" button by issuing two tabs and pressing a spacebar
-- comment it if needed
tell process "AirPort Utility"
keystroke tab
delay 2
keystroke tab
delay 2
key code 49
delay 2
end tell

end tell

delay 2
tell application "AirPort Utility" to quit -- we're all done, quit the AirPort Utility

I do not have earlier version of AirPort Utility - but I'm sure second script may work.There's no place like ~
RE: Reboot Time Capsule with ApplescriptPosted: Thursday, May 8, 2014 [16:30:17] - 2
rootPosted by:rootMember Since:
June 16 2010
Posts: 356
Forgot to mention, if Base station access password is set - computer must have accessible password in a keychain for a station you want to reboot.There's no place like ~
coding / applescriptPrev .. Next
 
Post Reply
Home - Coding: AppleScript C Perl Shell Xcode Other
Our Telegram Group