MacOS – How to tell AppleScript to read the contents of the “Network” Finder window

applescriptfindermacosterminal

I'd like to be able to get the contents of Finder's "Network" folder (Menubar–>Go–>Network). The folder contents here is different than /Network or /net.

The overall goal is to grep the names in this folder for a specific (unmanaged…) Mac in my environment. I don't know where it is, I just have the local host name. I was thinking about deploying a script to run dns-sd, but that binary is not too friendly to BASH script. Which is why I'm looking into Applescript now.

Best Answer

It appears that the Network Finder window isn't a folder. Attempting to get the location of Network gives the following error:

Can’t make «class cfol» "" of application "Finder" into type alias. (-1700)

…and attempting to get the location of the containing folder gives:

No result was returned from some part of this expression. (-2763)

Therefore I believe that Network is not a folder.