this applescript can be executed in an action group/type:server action/ script and file action/ execute script .
Copy and paste the applescript code there and change the userid, password, ip number of the router.
then execute the action script and the router will reset its wifi
Should work for ASUS 5x 6x 7x, they share the same code base
you could execute the wifiRestart manually by
open terminal
telnet routeripnumber
enter userid
enter password
type at the router prompt: /sbin/restart_wireless
Karl
Code: Select all
-- Karl Wachs
-- Aug 22 2014
-- version 1.1
-- applescript
--
-- ========> restart Asus WiFi using expect commands
--
--
set lf to ASCII character 10
set theRouterID to "therouteruseridhere"
set theRouterPassword to "therouterpasswordhere"
set theRouterIPNumber to "therouteripnumberhere"
set theR to "\\" & "\\" & "r"
set userName to short user name of (system info)
set theScriptFile to "/users/" & userName & "/Documents/scripts/resetwifi"
set theCommandrestartWireless to "/sbin/restart_wireless" -- this is the command to resetra wireless
-- create shell script with "expect" commands
do shell script "echo \"#!/usr/bin/expect\" > " & theScriptFile
do shell script "echo 'set theReturn " & theR & " ' >> " & theScriptFile
do shell script "echo 'set timeout 20 ' >> " & theScriptFile
do shell script "echo 'set ipNnumber [lindex $argv 0 ] ' >> " & theScriptFile
do shell script "echo 'set userID [lindex $argv 1 ]' >> " & theScriptFile
do shell script "echo 'set password [lindex $argv 2 ]' >> " & theScriptFile
do shell script "echo 'set routerCommand [lindex $argv 3 ]' >> " & theScriptFile
do shell script "echo 'spawn telnet $ipNnumber ' >> " & theScriptFile
do shell script "echo 'expect \"*?ogin:\" { send \"$userID$theReturn\" }' >> " & theScriptFile
do shell script "echo 'expect \"*?assword:\" { send \"$password$theReturn\" }' >> " & theScriptFile
do shell script "echo 'expect \"*?#\" {send \"$theReturn\" }' >> " & theScriptFile
do shell script "echo 'expect \"*?#\" {send \"$routerCommand$theReturn\" }'>> " & theScriptFile
do shell script "echo 'expect \"*?#\" {send \"$theReturn\" }'>> " & theScriptFile
-- make it executable
do shell script "chmod +x " & theScriptFile
-- execute it
do shell script theScriptFile & " " & theRouterIPNumber & " " & theRouterID & " " & theRouterPassword & " " & theCommandrestartWireless & "&"
Code: Select all
#!/usr/bin/expect
set theReturn \r
set timeout 20
set ipNnumber [lindex $argv 0 ]
set userID [lindex $argv 1 ]
set password [lindex $argv 2 ]
set routerCommand [lindex $argv 3 ]
spawn telnet $ipNnumber
expect "*?ogin:" { send "$userID$theReturn" }
expect "*?assword:" { send "$password$theReturn" }
expect "*?#" {send "$theReturn" }
expect "*?#" {send "$routerCommand$theReturn" }
expect "*?#" {send "$theReturn" }
...
you could execute the shell script once it is created in a terminal or in indigo with python or shell script..