Hi, found this 'solution?' on a forum for wifi loss in OSX LION 10.7.2.
Anybody here to tell me if this can be trusted?
Thanks in advance and Cheers!
"keepalive.sh"
#!/bin/bash
ping -i 5 -n yahoo.com
------------
"main.scpt"
set scriptName to "keepalive.sh" -- change this to what your script is called
set myPath to (path to me) as string
set myPath to posix_path(myPath)
do shell script "/bin/sh " & myPath & "Contents/Resources/Scripts/" & scriptName & " &> /dev/null"
on posix_path(mac_path)
set mac_path to (mac_path as text)
set root to (offset of ":" in mac_path)
set rootdisk to (characters 1 thru (root - 1) of mac_path)
tell application "Finder"
if (disk (rootdisk as string) is the startup disk) then
set unixpath to "/" & (characters (root + 1) thru end of mac_path)
else
set unixpath to "/Volumes:" & mac_path
end if
end tell
set chars to every character of unixpath
repeat with i from 2 to length of chars
if item i of chars as text is equal to "/" then
set item i of chars to ":"
else if item i of chars as text is equal to ":" then
set item i of chars to "/"
else if item i of chars as text is equal to "'" then
set item i of chars to "\\'"
else if item i of chars as text is equal to "\"" then
set item i of chars to "\\" & "\""
else if item i of chars as text is equal to "*" then
set item i of chars to "\\*"
else if item i of chars as text is equal to "?" then
set item i of chars to "\\?"
else if item i of chars as text is equal to " " then
set item i of chars to "\\ "
else if item i of chars as text is equal to "\\" then
set item i of chars to "\\\\"
end if
end repeat
return every item of chars as string
end posix_path
---------
Anybody here to tell me if this can be trusted?
Thanks in advance and Cheers!
"keepalive.sh"
#!/bin/bash
ping -i 5 -n yahoo.com
------------
"main.scpt"
set scriptName to "keepalive.sh" -- change this to what your script is called
set myPath to (path to me) as string
set myPath to posix_path(myPath)
do shell script "/bin/sh " & myPath & "Contents/Resources/Scripts/" & scriptName & " &> /dev/null"
on posix_path(mac_path)
set mac_path to (mac_path as text)
set root to (offset of ":" in mac_path)
set rootdisk to (characters 1 thru (root - 1) of mac_path)
tell application "Finder"
if (disk (rootdisk as string) is the startup disk) then
set unixpath to "/" & (characters (root + 1) thru end of mac_path)
else
set unixpath to "/Volumes:" & mac_path
end if
end tell
set chars to every character of unixpath
repeat with i from 2 to length of chars
if item i of chars as text is equal to "/" then
set item i of chars to ":"
else if item i of chars as text is equal to ":" then
set item i of chars to "/"
else if item i of chars as text is equal to "'" then
set item i of chars to "\\'"
else if item i of chars as text is equal to "\"" then
set item i of chars to "\\" & "\""
else if item i of chars as text is equal to "*" then
set item i of chars to "\\*"
else if item i of chars as text is equal to "?" then
set item i of chars to "\\?"
else if item i of chars as text is equal to " " then
set item i of chars to "\\ "
else if item i of chars as text is equal to "\\" then
set item i of chars to "\\\\"
end if
end repeat
return every item of chars as string
end posix_path
---------