Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Connect to servers with Applescript using Keychain' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Connect to servers with Applescript using Keychain
Authored by: Sesquipedalian on May 09, '06 05:42:40PM
Here's a nice simple version that will exit gracefully if the server can't be found.

tell application "Keychain Scripting"
	set serverKey to first key of current keychain whose name is "servername" --change servername to the name of the computer you are connecting to as it is listed in Keychain Access
	set acct to account of serverKey
	set pswd to password of serverKey
end tell

tell application "Finder"
	try
		mount volume "protocol://server/volume" as user name acct with password pswd --change the protocol and path to the appropriate data.  This can be found by mounting the server volume manually, and then doing a "Get Info" on it's desktop icon.
	end try
end tell


[ Reply to This | # ]