+ Post New Thread
Results 1 to 3 of 3
Mac Thread, Anyone good with Applescript? in Technical; I've created a script that it supposed to map each user on the network an individual drive that is stored ...
  1. #1

    Join Date
    Jan 2011
    Location
    Brighton
    Posts
    36
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    9

    Anyone good with Applescript?

    I've created a script that it supposed to map each user on the network an individual drive that is stored on a windows media server.

    It does the following;

    Mount share

    Create folder on share based on username

    Map that folder (ie share/username)

    Unmount share on higher level so user is left with share/username only.

    Only problem is that my script fails if the folder exists already.

    So i put an "if not exists" in but it appears to be doing nothing as when i run the script i get back "cannot create folder as it already exisits"..

    Can anyone point me in the right direction here? I've attached the script below.

    Thanks in advance!

    Martin




    Code:
    set username to (do shell script "whoami")
    
    set Media to " Media Files"
    
    mount volume "smb://172.22.8.23/macmedia$"
    
    tell application "Finder"
    	
    	if not (exists ("smb://172.22.8.23/macmedia$/" & username as text) & Media as text) then
    		
    		make new folder at "macmedia$" with properties {name:(username as text) & Media as text}
    		
    	end if
    	
    end tell
    
    
    tell application "Finder"
    	
    	set mnt to ("smb://172.22.8.23/macmedia$/" & username as text) & Media as text
    	
    	try
    		mount volume mnt
    		
    	end try
    	
    	eject "macmedia$"
    	
    end tell

  2. #2
    AntonioRocco's Avatar
    Join Date
    Oct 2008
    Location
    South Yorkshire
    Posts
    262
    Thank Post
    9
    Thanked 112 Times in 95 Posts
    Rep Power
    39
    Hi

    It's probably simply a typo but you have an extra space between the first double quotes and the word Media. Apart from that your question might get more attention if you posted here:

    https://discussions.apple.com/commun...#/?tagSet=1044

    Apple maintain other dedicated forums in addition to the AppleScript one. This one is for Unix:

    https://discussions.apple.com/commun...#/?tagSet=1048

    HTH?

    Antonio Rocco (ACSA)

  3. #3

    Join Date
    Jan 2011
    Location
    Brighton
    Posts
    36
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    9
    Hi Antonio,

    The space before media is just to split the text label for the folder so it's called username*space*Media Files. There was probably an easier way of doing this but I'm relativey new to applescript and that part of the script was working okay.

    Cheers for the link, i'll post up on the apple forum.

    I think my question can be simplified to "Using an "if not exists" command with a folder on an SMB share" so i'll post it as that.

    Thanks again,

    Martin

SHARE:
+ Post New Thread

Similar Threads

  1. Anyone good with printers?
    By BassTech in forum Hardware
    Replies: 3
    Last Post: 1st December 2011, 01:25 PM
  2. Anyone good with cars?
    By the_one_that_cant in forum General Chat
    Replies: 14
    Last Post: 28th January 2011, 04:25 PM
  3. SQUID issue, anyone good with squid?
    By bart21 in forum Internet Related/Filtering/Firewall
    Replies: 4
    Last Post: 23rd April 2010, 09:12 AM
  4. Can anyone help with this?
    By mattmoo in forum Netbooks, PDA and Phones
    Replies: 5
    Last Post: 15th February 2009, 04:21 PM
  5. Anyone good with video editing?
    By mcloum in forum How do you do....it?
    Replies: 7
    Last Post: 26th November 2008, 09:11 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •