Re: How to get IP in dial-up connection
Re: How to get IP in dial-up connection
- Subject: Re: How to get IP in dial-up connection
- From: SemiColon <email@hidden>
- Date: Mon, 13 Nov 2000 09:40:45 -0800
At 5:57 AM -0600 11/13/00, Azat Nurmagambetov wrote:
>
Hello,
>
>
I am rather a beginner in AS and started writing my first scripts using help modules . But I couldn't find a way to get a dynamic IP address when connecting via PPP/RA. Network OSAX only seems to provide an IP written in TCP/IP configuration..
>
I checked a few programs that get it (IPreporter etc)- how about plain vanilla/3rd party OSAX solution ?
I played around with this a while back and this is what I found:
--Four ways to get the IP address with AppleScript
--1 vanilla, faster than ASP
set status to state of (PPP status)
if status is "idle" then
RA connect with show status
RA save log to (path to startup disk as string) & "RA Log" with clearing entries
set texstrng to read file ((path to startup disk as string) & "RA Log") for 300
set disIP to last word of paragraph 1 of texstrng
else
RA save log to (path to startup disk as string) & "RA Log" with clearing entries
set texstrng to read file ((path to startup disk as string) & "RA Log") for 300
set disIP to last word of paragraph 2 of texstrng
end if
--2 vanilla, doesn't work with non static IP
tell application "Network Setup Scripting"
open database
set datIP to IP address of (TCPIP v4 configurations)
close database
set datIP to datIP as string
end tell
--3 vanilla, slow. Gets "not available" on first
-- try at login and needs to be asked twice
tell application "Apple System Profiler"
set myIP to TCPIP address of network info
activate --or I won't quit
quit
end tell
--4 Network Info OSAX - fastest
set daIP to IP address of (network information)
;