"Network Info" on OSX?

There’s a scripting additional called “Network Info 1.2” for OS 9. I need to use the function “AppleTalk entities”, but I need to use it on OS X 10.3. The main thing I need is a list of devices on the AppleTalk network with the name and IP address. The “Network Info” doesn’t provide IP address but rather the device names, type, network node, etc…

The computers on the AppleTalk network are on OS 9. My “main machine”, where I run the script is on OS X 10.3 Server.

Does anyone know of a way to do this?

Thanks,

-Luke

I myself have been looking around for this for a year or so, and found this.
Beware: it is not perfect and its functioning may show some latency (by the router…?) as machines go up and down, sleep, get removed or stolen in today’s networks.
However, it may help you out for the moment…


  -- I only have an Airport network interface and my router is set to 192.168.1.1, it supports addresses in that range until .....255
set IPs to paragraphs of (do shell script "arp -a | awk '{print $2}' | tr -d '()'")

Regards

That’s actually perfect. On my network it seems to function almost instantly. If I add “$1” to your example I get a mix of hostnames and IP address (hostname, ip, hostname, ip, etc…). Getting the hostname is important because all the computers in my lab begin with “lab”… So to avoid other computers all I have to do parse through the list using repeat and use a couple booleans to keep track of where I am and what I want to use:


set myNetwork to paragraphs of (do shell script "arp -a | awk '{print $1}{print $2}' | tr -d '()'")
set isHostname to true
set isLab to false
set priorHostname to ""

repeat with clientMachine in myNetwork
	if isHostname is true then
		if (offset of "lab" in clientMachine) is greater than 0 then
			set isLab to true
		else
			set isLab to false
		end if
		set priorHostname to myNetwork
	else
		if isLab is true then
			-- do stuff here. test dialog below
			display dialog priorHostname & " " & myNetwork
		end if
	end if
end repeat

Thanks :). That should work even if/when we finally get OS X client machines :D.

Hi,

I don’t know, if this works in all cases:
In the lists servers and IPs is the result

tell application "System Events"
	set servers to name of disk items of disk "Network" whose its file type is "slua"
end tell
set IPs to {}
repeat with i in servers
	set theIP to do shell script "arp -n " & i & ".local | cut -f 2 -d '(' | cut -f 1 -d ')'"
	if theIP is "" then
		set end of IPs to "not available"
	else
		set end of IPs to theIP
	end if
end repeat

Stefan,

It seems that your little baby has been bitten by Leopard:


tell application "System Events"
   set servers to name of disk items of disk "Network" whose its file type is "slua"
end tell

Any idea’s for a repair…?

Hi Eelco,

it doesn’t seem, it does!
Unfortunately there is no disk network any more in Leopard,
and I couldn’t find (yet) an equivalent to retrieve the information of the available servers.

You can get the connected servers with


tell application "System Events"
    set connectedServers to {}
    repeat with i in (get properties of disks)
        if server of i is not missing value then set end of connectesServers to name of contents of i
    end repeat
end tell

but this is not the same.

But there must be a way, because

choose URL showing File servers

is still working

Too bad, as I found your snippet more elegant.
Pfff, I am already reverting all my scripts towards


set myResults to do shell script "ping -c 1 -q " & "192.168.1.255"
set IPs to paragraphs of (do shell script "arp -a | awk '{print $2}' | tr -d '()'")