acquiring active TCP/IP Address

This board has always been so helpful and prompt. So, I’m back again with another dilemma.

I’ve been able to find plenty of documentation on altering the TCP/IP address in OS 9 but I’d like to know how to acquire the active IP address and store it as a string variable. Any help would be greatly appreciated.

Thank you for your time.

This works nicely for me - OS 9.1/AppleScript 1.6:

-- error -- force an error to test the "on error" code 
set currentAddress to (tcp my address) as text -- Uses "TCP/IP Scripting Add PPC" osax if installed. Much quicker. 
on error -- This gets the current IP address if the osax referenced above is NOT installed. 
with timeout of 4 seconds -- This might need to be changed, depending on your setup. 
tell application "Network Setup Scripting" 
open database 
set tcpConfig to name of item 1 of every TCPIP v4 configuration whose active is true 
set currentAddress to IP address of TCPIP v4 configuration tcpConfig 
close database -- It's always best to close everything that the script opens. 
on error 
close database -- It's always best to close everything if an error occurs. 
end try 
end tell 
end timeout 
end try
display dialog currentAddress