Straightforward way to populate the Favorite Servers list in a script?


I’m an ultra-Newbie at AppleScripting, so please be gentle.

What I’m trying to do is conceptually very simple. I want to have a script run every time every user logs in that adds two addresses to our Windows file server to the list of Favorite Servers (from within the Connect to Server dialog). They’ll be two different shortcuts to the same server, one for AFP and one for SMB file-sharing.

I found that the list of servers is determined by the Internet Location files within the user’s Favorites folder. I manually created two Internet Location files: “address.inetloc” and “address.afploc”, and I tossed them in a random folder. I then wrote a script that duplicates those two files to the user’s Favorites folder. Piece of cake.

Here’s the problem. When I go to Connect to Server, only the AFP shortcut appears, even though both were successfully duplicated. Even more puzzling is that if I manually drag the “address.inetloc” file into the Favorites folder, it works precisely as it should. But something is getting lost in the translation when I try to duplicate the file in a script.

Any ideas as to why this is? And if not, is there a more straightforward way to populate the Favorite Servers list in a script?

Thanks for any help… I’ve got a headache over this one (probably from pounding my head on my desk).

Mike D.

You can try something as this:

set serverList to {"afp://", "afp://"}
choose from list serverList with prompt "Choose a server..."
if result is not false then open location (result as text)

You can also include user names and passwords, so the authentication dialogs are surpassed. Take a look here: