I use the following AppleScript to share my broadband internet connection with my USB-attached irDA adapter. This allows my Palm to use my network connection so I can sync AvantGo (modem sync) and download emails direct from my POP account on the net.
First you need to share your ethernet connection (don't know about modem dial-up) by pressing Start in the Internet tab of the Sharing control panel. Then edit the script below and insert the following details (all are needed):
(* Fill in these values *)
property admin_password : ""
property irda_device_name : ""
property dns_address : ""
property mac_ip_address : ""
property irda_ip_address : ""
on run
checkStatus()
end run
on checkStatus()
set shellreturn to ""
try
set shellreturn to do shell script ¬
"ps -ax | grep pppd | grep -v grep" password admin_password ¬
with administrator privileges
on error errText number errNum
end try
if shellreturn ? "" and (offset of ("/dev/" & irda_device_name) ¬
in shellreturn) > 0 then
set theReply to display dialog ¬
"Network is available on IR Port." buttons ¬
{"Quit", "Stop & Quit"} default button "Stop & Quit" with icon 0
if button returned of theReply is "Stop & Quit" then ¬
stopService((word 1 of shellreturn) * 1)
else
set theReply to (display dialog ¬
"Network is NOT available on IR Port." buttons ¬
{"Quit", "Start"} default button "Start" with icon 0)
if button returned of theReply is "Start" then startService()
end if
end checkStatus
on startService()
set shellreturn to do shell script ¬
("/usr/sbin/pppd /dev/" & irda_device_name & " 115200 " & mac_ip_address ¬
& ":" & irda_ip_address & ¬
" proxyarp passive silent persist noauth local ms-dns " & dns_address) ¬
password admin_password with administrator privileges
if shellreturn ? "" then
display dialog "Error returned when trying to start networking:" & ¬
return & shellreturn
end if
delay 2
checkStatus()
end startService
on stopService(procnum)
set shellreturn to do shell script ("kill " & procnum) password ¬
admin_password with administrator privileges
if shellreturn ? "" then
display dialog "Error returned when trying to stop networking:" & ¬
return & shellreturn
end if
end stopService
Hope this is useful. Have done no testing apart from my machine at work and at home.
Mac OS X Hints
http://hints.macworld.com/article.php?story=2003100320020783