auto connect to shares

subrandom

Limp Gawd
Joined
Sep 18, 2004
Messages
185
Okay so i've been searching around for a while and i can't seem to exactly find the right script or application to do what im looking for. I have a macbook and my main pc and just have the laptop connect through wifi. What i would like to do is have my macbook auto connect to the shares on my main PC when it connects to this spacific network and no i don't want to do it "at login" because i never shut this machine down all the way. So any links? Ideas? Or just a simple script? just wondering cause its been a bitch finding info on the subject. Thanks in advance.
 
rebump, i really have no clue any help would be awesome cause its pretty sad if this is just impossible
 
There are some applescripts available on the web to do this, but there is also a very easy way.

First, connect to the share from the finder.
Open System Preferences, then Accounts.
In the Login Items "tab", drag the mounted volume on the desktop to the login items area. (In the middle)

Thats it. I also have my username/pw for the network volume stored in the keychain so I don't need to enter it everytime I log in. Hope that helps.
 
methocl said:
There are some applescripts available on the web to do this, but there is also a very easy way.

First, connect to the share from the finder.
Open System Preferences, then Accounts.
In the Login Items "tab", drag the mounted volume on the desktop to the login items area. (In the middle)

Thats it. I also have my username/pw for the network volume stored in the keychain so I don't need to enter it everytime I log in. Hope that helps.

cool, that works
 
methocl said:
There are some applescripts available on the web to do this, but there is also a very easy way.

First, connect to the share from the finder.
Open System Preferences, then Accounts.
In the Login Items "tab", drag the mounted volume on the desktop to the login items area. (In the middle)

Thats it. I also have my username/pw for the network volume stored in the keychain so I don't need to enter it everytime I log in. Hope that helps.
I think the OP knows about that, thus this:
OP said:
and no i don't want to do it "at login" because i never shut this machine down all the way.
Sorry, I can't help....
 
yeah see thats the thing, its not login related, its that i leave the network and shares have to be disconnected then when i reenter the network i want them auto mounted and login items don't relate to that exchange. However yes if i logout and log back in then that would work just fine however as i stated in my origional post i don't do that but thanks for the tries... i guess i'll keep looking.
 
Hmm...

generally I have a shortcut to the Share under a folder on my desktop (I connect to several different networks during the course of work, so a folder for each site).

Usually, I just double click whatever share I need to get to, and it will re-connect itself (providing I have my login info stored)


edit: I should look into an Applescript / Automator process / shell script to do all this though.
 
I would just drag the shares into the dock so you can reconnect as needed.

Assuming you have the passwords stored in the keychain for that login, it should reconnect right away when clicked.
 
I have a script that automatically mounts AFP shares, entering the password and everything. I'll try to find it, and share it. The downside is that you'll have to type the password in plain text in the script, so it's not exactly secure.
 
Here is the script I wrote. If you save it as a run-only application with the proper privileges your passwords will be relatively safe. It's not very refined, but it gets the job done.

Code:
global mountTest

on run
	--This gets the currently mounted volumes.
	set mountTest to (list disks)
	
	-- List your shares here 
	--The variables passed to the routines need to be strings.
	--Just make as many mount entries as you have servers to mount.
	
	-- This example mounts the public volume a file server as a guest with password guest
	--my smbmount("Guest", "guest", "192.168.0.24", "Public")
	--This is just another example
	--my smbmount("Tech", "Tech0195", "192.168.0.199", "Tools")
	--These are examples for appletalk
	--my afpovertcp(user_name, pass_word, ip_address, share_name)
	--my afpmount(user_name, pass_word, ATservername, zone_name, share_name)
	--my nfsmount("192.168.0.4", "Storage")
	--my ftpmount("Anonymous", "anonymous", "ftp.ftp.com")
end run

on smbmount(user_name, pass_word, ip_address, share_name)
	--We don't want to try and mount the volume if it's already mounted.
	--In 10.1 it caused lockups.  In 10.2 if "Public" is already mounted the
	--machine would make a new mount "Public 1" to the same share.
	if mountTest does not contain share_name then
		try
			tell application "Finder"
				activate
				mount volume "smb://" & user_name & ":" & pass_word & "@" & ip_address & "/" & share_name & ""
			end tell
		end try
	end if
end smbmount

on afpovertcp(user_name, pass_word, ip_address, share_name)
	--We don't want to try and mount the volume if it's already mounted.
	--In 10.1 it caused lockups.  In 10.2 if "Public" is already mounted the
	--machine would make a new mount "Public 1" to the same share.
	if mountTest does not contain share_name then
		try
			tell application "Finder"
				activate
				mount volume "afp://" & user_name & ":" & pass_word & "@" & ip_address & "/" & share_name & ""
			end tell
		end try
	end if
end afpovertcp

on afpmount(user_name, pass_word, ATservername, zone_name, share_name)
	--We don't want to try and mount the volume if it's already mounted.
	--In 10.1 it caused lockups.  In 10.2 if "Public" is already mounted the
	--machine would make a new mount "Public 1" to the same share.
	if mountTest does not contain share_name then
		try
			tell application "Finder"
				activate
				mount volume "afp:/at/" & user_name & ":" & pass_word & "@" & ATservername & ":" & zone_name & "/" & share_name & ""
			end tell
		end try
	end if
end afpmount


on ftpmount(user_name, pass_word, ip_address)
	--We don't want to try and mount the volume if it's already mounted.
	--In 10.1 it caused lockups.  In 10.2 if "Public" is already mounted the
	--machine would make a new mount "Public 1" to the same share.
	set share_name to (user_name & "@" & ip_address) as string
	if mountTest does not contain share_name then
		try
			tell application "Finder"
				activate
				mount volume "ftp://" & user_name & ":" & pass_word & "@" & ip_address
			end tell
		end try
	end if
end ftpmount

on nfsmount(ip_address, share_name)
	--We don't want to try and mount the volume if it's already mounted.
	--In 10.1 it caused lockups.  In 10.2 if "Public" is already mounted the
	--machine would make a new mount "Public 1" to the same share.
	if mountTest does not contain share_name then
		try
			tell application "Finder"
				activate
				mount volume "nfs://" & ip_address & "/" & share_name
			end tell
		end try
	end if
end nfsmount
 
That's basically the same thing as my script, except it works with other stuff than AFP. I guess I won't bother, then. :p
 
Back
Top