Alright heres the deal. I play an online game and am suffering from random internet freezes that require me to manually click on the Airport Icon and reconnect to my network in order to continue playing. I am looking for an apple script compatible with the Airport UI for the 10.5 OS X which pings my internet connection at certain time intervals and then and restarts the airport if a drop has happened. I found an applescript that would work, but it is for the 10.4 OS X. It is not friendly with the new UI of Leopard's Airport Utility. Basically I need a translation of this 10.4 script to become a 10.5 compatible script. I'm not very skilled in Applescript so I cannot do it myself. Please help.
Heres the script:
----------------------------------------------------------------------------------------------------------------------------
repeat
restartIfNecessary()
do shell script "sleep 300"
end repeat
on restartIfNecessary()
set s to "ping -c 1 -t 4 4.2.2.1 > /dev/null; echo $?"
set r to do shell script s
if r is equal to "0" then
dlog(((current date) as string) & " AirPort OK")
else
dlog(((current date) as string) & " AirPort down. Restarting.")
restartAirPort()
end if
end restartIfNecessary
on restartAirPort()
tell application "AppleScript Utility"
activate
delay 2
tell application "System Events"
tell window 1 of process "Internet Connect"
try
tell button "AirPort" of tool bar 1 to click
delay 2
end try
try
tell button "Turn AirPort Off" to click
delay 7
end try
try
tell button "Turn AirPort On" to click
delay 2
on error
try
tell button "Turn AirPort Off" to click
end try
end try
end tell
end tell
quit
end tell
end restartAirPort
on dlog(msg)
set t to ((path to temporary items) as string) & "AirPortRestarter.log"
set f to open for access file t with write permission
write msg & "
" to f starting at (get eof of f) + 1
close access f
end dlog
-------------------------------------------------------------------------------------------------------------------
I did not make this script, nor do I take credit for any part of this. Please help me with my issue!
Heres the script:
----------------------------------------------------------------------------------------------------------------------------
repeat
restartIfNecessary()
do shell script "sleep 300"
end repeat
on restartIfNecessary()
set s to "ping -c 1 -t 4 4.2.2.1 > /dev/null; echo $?"
set r to do shell script s
if r is equal to "0" then
dlog(((current date) as string) & " AirPort OK")
else
dlog(((current date) as string) & " AirPort down. Restarting.")
restartAirPort()
end if
end restartIfNecessary
on restartAirPort()
tell application "AppleScript Utility"
activate
delay 2
tell application "System Events"
tell window 1 of process "Internet Connect"
try
tell button "AirPort" of tool bar 1 to click
delay 2
end try
try
tell button "Turn AirPort Off" to click
delay 7
end try
try
tell button "Turn AirPort On" to click
delay 2
on error
try
tell button "Turn AirPort Off" to click
end try
end try
end tell
end tell
quit
end tell
end restartAirPort
on dlog(msg)
set t to ((path to temporary items) as string) & "AirPortRestarter.log"
set f to open for access file t with write permission
write msg & "
" to f starting at (get eof of f) + 1
close access f
end dlog
-------------------------------------------------------------------------------------------------------------------
I did not make this script, nor do I take credit for any part of this. Please help me with my issue!