AppleScript help for server mounting automation

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

  1. elwyn1979 macrumors newbie

    Joined:
    Apr 17, 2014
    #1
    Hi

    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.

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

    kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Please do post what you have managed so far. Don't forget to use the
    Code:
     tags for your code.
    
    Perhaps this [URL="http://images.apple.com/business/docs/Autofs.pdf"]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

    Joined:
    Apr 17, 2014
    #3
    Reply

    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.
    Code:
    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"
    	try
    		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
    				try
    					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
    						return
    					end tell
    				end try
    				return
    			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.
    Code:
    tell application "AppleScript Editor"
    	launch
    	activate
    	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