Sunday, July 22, 2018

#1 2003-05-09 08:22:53 am

Sketch
Member
Registered: 2003-04-30
Posts: 9

Format and flow

I dislike asking such a newbie question like this, but I'm running out of time and I have to get my project done.

The script is supposed to mount a share. The server name is variable and so is the share name.

Server is to be selected via a popup menu. There's only Choice1 and Choice2
Sharename is dependant upon what's entered into a text field.

how should this look? I'm just not sure what goes where in what order.

Offline

 

#2 2003-06-03 05:40:56 pm

andy_boretto
Member
Registered: 2003-01-02
Posts: 28

Re: Format and flow

I dislike asking such a newbie question like this, but I'm running out of time and I have to get my project done.

The script is supposed to mount a share. The server name is variable and so is the share name.

Server is to be selected via a popup menu. There's only Choice1 and Choice2
Sharename is dependant upon what's entered into a text field.

how should this look? I'm just not sure what goes where in what order.


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.

Applescript:


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


I am not speaking for my employer.  These views are my own

Offline

 

#3 2003-06-25 03:29:25 pm

Sketch
Member
Registered: 2003-04-30
Posts: 9

Re: Format and flow

This was a great help! Thanks!  big_smile  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:

Applescript:

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


Filed under: Finder

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)