• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get IP in dial-up connection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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)

;


References: 
 >How to get IP in dial-up connection (From: Azat Nurmagambetov <email@hidden>)

  • Prev by Date: Re: Dialects
  • Next by Date: Re: Dialects
  • Previous by thread: How to get IP in dial-up connection
  • Next by thread: attach folder action to trash
  • Index(es):
    • Date
    • Thread