AppleScript help for server mounting automation

Discussion in 'Mac Programming' started by elwyn1979, Apr 17, 2014.

  1. elwyn1979 macrumors newbie

    Apr 17, 2014

    I'm trying to create a script for new users at my work to automate servers they are connecting to. What i would like to do is create a script that list all the possible servers as a dialog list (I have managed to do this)
    Then once they select the servers they will need it creates a script that then adds that script to the login items.

    So far I can create the dialog list with the servers
    I know how to add items you add into a script to the login items
    And i've looked into Scripts creating scripts. This looks possible.

    I might be over complicating the issue but this would save me so much works as be the only mac support analyst support over 300 users it would be great help..

    Let me know if you want me to post what i have so far on line.

  2. kryten2, Apr 17, 2014
    Last edited: Apr 17, 2014

    kryten2 macrumors 6502a

    Mar 17, 2012
    Please do post what you have managed so far. Don't forget to use the
     tags for your code.
    Perhaps this [URL=""]link[/URL] might be useful as well.
  3. elwyn1979, Apr 18, 2014
    Last edited by a moderator: Apr 18, 2014

    elwyn1979 thread starter macrumors newbie

    Apr 17, 2014

    Thanks for the response and link...
    This is what i have so far.

    The below script will run and provide a prompt with a server list and mounts the volume. Works well.
    property server_list : {{name:"name", address:"smb://server/share", volume:"User1"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User2"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User3"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User4"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User5"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User6"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User7"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User8"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User9"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User10"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User11"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User12"}, ¬
    	{name:"name", address:"ssmb://server/share", volume:"User13"}, ¬
    	{name:"name", address:"smb://server/share", volume:"User14"}}
    tell application "Finder"
    		eject disk "share"
    	end try
    end tell
    set display_list to {}
    repeat with the_item in server_list
    	set display_list to display_list & name of the_item
    end repeat
    set choice to choose from list display_list with title "Disney Servers " with prompt "Please select your name to mount your drive" with multiple selections allowed
    if result is false then return
    if choice is not {} then
    	repeat with the_name in choice
    		repeat with the_server in server_list
    			if (name of the_server) is equal to the_name as string then
    					tell application "Finder"
    						set x to mount volume (address of the_server & "/" & volume of the_server)
    						log address of the_server
    						display dialog "You have mounted your drive successfully. Click OK to exit." with title "Mount Drive" with icon note buttons {"OK"} default button 1
    					end tell
    				end try
    			end if
    		end repeat
    	end repeat
    end if

    Seen this script to create the apple script and place into a directory but not sure how to make it work with the above script.
    tell application "AppleScript Editor"
    	make new document with properties {contents:part2}
    	save document 1 in "Macintosh HD:MountScanFolder" as application
    end tell
    --end if
    --on error
    --    set answer to {button returned:"No"}
    thanks again

Share This Page