As in Mac OS 9, you can make new
files and folders with Mac OS X and AppleScript by using the
Finder’s make
command. Example 32-3 creates a new folder called
“NewFolder” in the Desktop folder
of the currently logged in user.
tell application "Finder" make new folder at desktop with properties{name:"NewFolder"} end tell
You can also create new files like aliases with the new Mac OS X
Finder. One Finder quirk that has been corrected in OS X is the
necessity to use the syntax make file at...
as
opposed to make new file at...
when code is making
a new file. Under OS 9 and its predecessors, you generally have to
use the make new...
syntax when making everything
but file objects. Example 32-4 asks the user for a
file reference, using the choose file osax, and
then creates an alias
to that file with the
default name of “[file name] 2.” In
other words, if the original file is named
“newfile,” then the alias is named
by default “newfile 2.”