Initial guesses after brief consideration…
In this example, the “formnum” variable contains a file reference to the
folder that is being created. I haven’t tried to run the code but:
This might lead to a file name which is too long or which contains
characters which aren’t suitable for file/folder names.
It might not be possible to use the variable in the same command that
is assigning the value of the variable.
Rob
Yes it is, the problem here is in ‘make new folder in folder myvendor in disk…etc’; at that point , you already set myfolder to be a folder, not the name of a folder, wich is a string, so it should work with: tell application “Finder” to set formnum to make new folder in myvendor with properties {name:formnum} It is what the finder says it is: an invalid key form. changing the type of avariable on the fly is a very powerful but to-be-used-with-caution feature.
take care, karl
The result of creating a new folder is the full folder specification of the new folder, so you don’t need ‘in folder myvendor in disk “Media”…’ you only need ‘in myvendor…’ and use a different variables for folder names and results. It’s possible to reuse the variables (set myvendor to make folder name: myvendor), but better to avoid doing so when possible.
tell application "Finder"
set vendorFolder to (make new folder in disk "Media" with properties {name:myvendor})
set formfolder to (make new folder in vendorFolder with properties {name:formnum})
end tell