Mount SMB share only on specific network, help plz.

I’ve had a fairly thorough search using all the possible keywords i can think of to find this, so sorry if there is actually a thread explaining how to do this.

I’m after a way of mounting a smb share on login, after a small delay, and only when connected to a certain wireless network (the small delay being enough time for the wireless to connect).

i was using

delay 5
mount volume "smb://Smithstore/Haydz1"

and that was working fine for if i was at home and connected to the wireless, but i’m not too sure on what to do to make it so that only happens when the network is present.

i looked in another thread, and my guess is i’d do something like:

delay 5
if Network Name = "Smithnet" then
mount volume "smb://Smithstore/Haydz1"

but i’m fairly new to all of this, so i’m sure there’s something basic i’m missing here. also, how would i go about adding an else line to quit msn messenger? would it just be

else killAll Microsoft Messenger

on the bottom?

any help would be really appreciated. once again, sorry if there’s already a similar thread that i didn’t manage to find

Cheers,
Haydz

MBP4,1
10.5.2

Hi and welcome :slight_smile:

Try this


property time_out : 10

repeat time_out times
	set currentSSID to do shell script "/usr/sbin/networksetup -getairportnetwork"
	if currentSSID contains "AirPort power is currently off" then return
	if currentSSID does not contain "not associated" and text 26 thru -1 of currentSSID is "SmithNet" then
		mount volume "smb://Smithstore/Haydz1"
		exit repeat
	end if
	delay 1
end repeat

works perfectly at home- tested it’s functionality while connected, and with wifi off. will test completely next time i’m at work, but at this stage, it looks like it’ll work fine. much appreciated.

thanks
Haydz