2 Replies Latest reply: Oct 5, 2012 9:39 AM by RubixChick
RubixChick Level 1 Level 1 (0 points)

Hi Guys,

 

I'm new to applescripts and am getting used to writing variables. I've written something because I want to create a folder structure on a specific path and assigned a variable to the path. However, I'm getting a -1700 error, it "can't make \"/mypath" into type item". Am I assigning the variable or writing the path correctly?

 

tell application "Finder"

     --variable for path

               set pathHere to "/Volumes/myName/Documents/clients"

     --make new folders with names

     make new folder at pathHere with properties {name:"New Project"}

end tell

 

Thanks!

 

Rubixchick


iMac, Mac OS X (10.7.4)
  • 1. Re: Applescript: Assigning a variable to a path
    Niel Level 10 Level 10 (241,865 points)

    Use the following:

     

    tell application "Finder"

    --variable for path

    set pathHere to "myName:Documents:clients"

    --make new folders with names

    make new folder at folder pathHere with properties {name:"New Project"}

    end tell

     

    The second 'folder' in the fifth line isn't needed when working with the Finder, but some applications may not accept a text string not explicitly stated as being a path.

     

    (70457)

  • 2. Re: Applescript: Assigning a variable to a path
    RubixChick Level 1 Level 1 (0 points)

    Hi Niel,

     

    Okay so the path is written using colons rather than slashes and writing the second "folder" in is a safety pre-caution because some applications won't accept it. Awesome! This worked for me. Thank you very much.

     

    Rubixchick