Question

set folder_1 to text returned of (display dialog "Create Folders:" default answer "Type Here")
set folder_2 to "new_" & folder_1

set loc1 to ":path1"
set loc2 to ":path2"


tell application "Finder"
    set newfo1 to make new folder at loc1 with properties {name:folder_1}
    make new folder at newfo1 with properties {name:"new folder"}
    make new folder at newfo1 with properties {name:"new folder"}
    make new folder at newfo1 with properties {name:"new folder"}
    make new folder at newfo1 with properties {name:"new folder"}

    set newfo2 to make new folder at loc2 with properties {name:folder_2}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}
    make new folder at newfo2 with properties {name:"new folder"}

make alias at folder_1 to folder_2  

end tell

Can anybody shed light on creating an alias in the above code. I'm trying to create an alias of {name:folder_2} inside {name:folder_1} but using that variable I get a Finder got an error: AppleEvent handler failed. Could anyone help out?

Very many thanks

Was it helpful?

Solution

Looks like all you need to do is to change your make alias statement to use the newly created folder objects:

make alias at newfo1 to newfo2

Note that your code doesn't deal with the cases where any of the folders you create already exist (in which case you'd get error "The operation can’t be completed because there is already an item with that name." number -48).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top