Hi,
Basically, I have to connect and reconnect to the same servers all day long and I got tired of having to command + k everytime, so I wrote an applescript to do this all for me:
property uName : "ryan"
property uPass : ""
tell application "Finder"
-- Edit this to your settings
display dialog "I am now going to mount the Server." buttons {"Mount", "Cancel"} default button 1 with icon 1
set theServer to "afp:/at/CSG4:*"
display dialog "Enter Your User Name:" default answer uName
set theUser to the text returned of the result
display dialog "Enter Your User Password:" default answer uPass
set thePass to the text returned of the result
try
mount volume theServer as user name theUser with password thePass
display dialog "The Server has been mounted." buttons {"OK"} default button 1 with icon 1
---- launch the app.
on error
display dialog "I'm Sorry. CSG4 is not available right now."
end try
end tell
And this works… except laziness gets the best of me again. I never change my username and pass and I am tiring of typing in my pass as it rarely changes.
So i changed it to read my pass from a text file:
property uName : "ryan"
property uPass : ""
tell application "Finder"
-- Edit this to your settings
set button_pressed to button returned of (display dialog "I am now going to mount the Server." buttons {"Mount", "Cancel", "Edit Password"} default button 1 with icon 1)
if button_pressed is "Mount" then
set theServer to "afp:/at/CSG4:*"
set thePath to ":Volumes:Macintosh HD:Users:ryan:Library:Scripts:Mounter:"
set theFile to (thePath & "csg4pass2.txt") as string
set fileRef to (theFile) as alias
set fileRef to (open for access theFile)
set thePass to ""
set thePass to (read fileRef)
close access fileRef
tell application "Finder"
set theUser to uName
mount volume theServer as user name theUser with password thePass
--display dialog "The Server has been mounted." buttons {"OK"} default button 1 with icon 1
---- launch the app.
end tell
else
display dialog "Enter Your User Password:" default answer uPass
set thePass to the text returned of the result
set thePath to ":Volumes:Macintosh HD:Users:ryan:Library:Scripts:Mounter:"
set theFile to (thePath & "csg4pass2.txt") as string
set fileRef to (theFile) as alias
set fileRef to (open for access theFile with write permission)
set eof of fileRef to 0
write thePass to fileRef
end if
end tell
When looking at the event log, i see the same events being passed thru, but I get the normal dialog box asking me for my username and pass instead of just mounting the drive. Any ideas why? If not, it is no big deal as you would just be assiting in my laziness. Next step, Mojo, the monkey helper!
Thanks,
Ryan