Test to see if TCP/IP is active

I’m wanting to write a script to test whether or not a Mac (running OS 8.6) has TCP/IP activated or not.
Initiallly I wrote a script to try and connect to an AppleShare IP server and if it failed, it would display an error message. However, the error message is displayed even if TCP/IP is active but just because the AppleShare server is inaccessible for other reasons.
Eventually I want to have a script to turn on/off TCP/IP as and when required (this is easy enough to script), but I want for now I want a script to test whether or not it is active, rather than having to go into the TCP/IP control panel etc.
Can you help?

I too am looking to do this, so I’ll be watching this post carefully - - - in particular, In OS 8.5, 8.6 it appears that one gets a “WHERE IS Network Setup Scripting” dialog when you run this script. From past posts, I’m assuming that I need to go into ResEdit and find out what the creator-type is for Network Setup Scripting and find the app via that means. However then there’s all the “raw event code” work that needs to replace the “TCPIP v4 configuration” calls when referencing those dictionary terms. Is there a better way, or am I just making like difficult for myself? My goal is to run this script without pestering the user to find Network Setup Scripting.


set activeTCP to {}
tell application “Network Setup Scripting”
open database
set activeTCP to name of item 1 of every TCPIP v4 configuration whose active is true
close database
on error
close database
end try
end tell
if activeTCP is {} then display dialog “There is no active TCP/IP configuration.”