here's one using a non stock osax:
Network Info
the code for that is a one liner:
get IP address of (get network information)
if you wanted to email your IP to someone, use the
Sendmail OSAX sample code for that:
<applescript code>
global g_IP
-- makes g_IP global to the whole script
property p_From : "Your Mac <
[email protected]>"
-- sets the FROM header the adress must be enclosed by angle brackets <>
property p_To : " Your Other Address <
[email protected]>"
-- sets the TO header the adress must be enclosed by angle brackets <>
property p_Sub : ""
-- sets the SUBJECT
property p_Sig : ""
-- sets a signature if you want one
property p_messageBody : ""
-- the message body
property p_mailserver : "smtp.telusplanet.net"
-- your mail server (where the mail gets sent through)
property p_miscHeaders : "x-mailer: AppleScript with sendmail v.1.0
x-URL:
http://www.apple.com/applescript/
Content-Type: text/plain; charset=us-ascii
" -- sets some headers, for X-mailer (identifying the mail client, x-url for the mail client's url, and the content type of the mail
set g_IP to (get IP address of (get network information) as text)
-- gets the mac's IP address, this needs the NetworkInfo OSAX
set p_mishHeoaders to p_miscHeaders & "x-ip-address:" & g_IP & "
" -- appends a x-ip-address header to the headers
set p_Sub to p_Sub & g_IP as text
-- appends the actual IP to the subject
set p_messageBody to g_IP as text
-- sets the message body
send email "From: " & p_From & return & "To: " & p_To & return & "Subject: " & p_Sub & return & p_miscHeaders & "x-ip-address: " & g_IP & return & p_messageBody & p_Sig via p_mailserver
-- sends the email
</applescript code>
hope this helps
------------------
PGP key:
http://www.geocities.com/maccanada/pgpkey.html
-30-