This assumes you have a text field named “shareName” and a popup button “popupMenu” in a window named “main”
then you get the contents of the text field and the selected popup menu item. Place them into a string and then mount the server.
Add error handling in case a user didnt put in a share name.
on clicked theObject
set theSharename to the contents of text field "shareName" of window "main"
set theServerToMount to the title of popup button "popupMenu" of window "main"
set mountMe to theServerToMount & "/" & theSharename as string
mount volume "afp://" & mountMe
end clicked
This was a great help! Thanks! things are starting to click in my head (I ditched this for a while and am now coming back to it)
so far this is what it looks like:
on clicked theObject
if title of theObject is "Connect" then
set theSharename to the contents of text field "username" of window "main"
set theServerToMount to the title of popup button "usertype" of window "main"
set mountMe to theServerToMount & "/" & theSharename & "$" as string
tell application "Finder"
try
mount volume "smb://" & mountMe
end try
end tell
else if title of theObject is "Cancel" then
quit
end if
end clicked
I’m letting the OS handle the authentication, instead of sending the “username:password@server/share” method, in the hopes of having a tad bit more security.
Now I’m trying to figure out how to autofill the Username and to have the script to close upon succesful mounting of the share