
You can also choose to add you username and password here by entering afp://user:pass@server/share instead.

if (do shell script "ping -c1 readynas") contains "1 packets received" then
try
if (list disks) does not contain "media" then
mount volume "afp://readynas/media"
end if
end try
try
if (list disks) does not contain "shared" then
mount volume "afp://readynas/shared"
end if
end try
end if
on quit
continue quit
end quit
Do I need to replace something with the IP of my ReadyNas, or am I missing something else?
mkdir /Volumes/Media; mount_afp afp://user:pass@10.0.0.2/Media /Volumes/Media
tell application "Finder" to close every windowNo problem. I have never suffered from any residual open windows, I'm guessing because when I save the App in Script Editor I uncheck both "Startup Screen" and "Stay Open" boxes, and also select "Hide" checkbox on the Login Items list. I haven't tested that to prove it though.schalliol wrote:For those who wish to close windows after mounting, you can create a script (or add to another script) with the following line.
mattclark04 wrote:Or, for a more low-level/technically correct (i.e. avoiding finder/login hacks) approach, try opening a terminal and typing 'man automount' (though to be fair, these being UNIX help pages, that may not quite do the trick!)
I have the following in my /etc/fstab file:
# -------------------------------------------------------------------------------------
# Mount AFP shares from the ReadyNAS
# servername:/path mount_point url auto,url==afp://username:password@server/path 0 0
# -------------------------------------------------------------------------------------
forth.local:/music /Volumes/music url auto,url==afp://media:media@forth.local/music 0 0
forth.local:/music /Volumes/movies url auto,url==afp://media:media@forth.local/movies 0 0
Which makes /Volumes/music and /Volumes/movies automagically mount the relevant AFP shares. Then it's a simple matter of symlinking what dirs you want, such as 'ln -s /Volumes/movies ~/Movies'
# -------------------------------------------------------------------------------------
# Mount AFP shares from the ReadyNAS
# -------------------------------------------------------------------------------------
# For account with User and Password
# servername:/path mount_point url auto,url==afp://username:password@server/path 0 0
#
# For Guest Account (with .local suffix example):
# servername.local:/mp3 /Volumes/mp3 url auto,url==afp://;AUTH=No%20User%20Authent@servername.local/mp3 0 0
# -------------------------------------------------------------------------------------
servername.local:/mp3 /Volumes/mp3 url auto,url==afp://;AUTH=No%20User%20Authent@servername.local/mp3 0 0
servername.local:/Media /Network/Media url auto,url==afp://;AUTHaH=No%20User%20Authent@servername.local/Media 0 0
# -------------------------------------------------------------------------------------
Users browsing this forum: No registered users and 3 guests