Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Finder Guide /
Chapter 3 - Finder Commands / Command Definitions


The standard application command Make is a request to create a new object that can include values for properties of the object. The Finder version of the Make command is similar to the version described in the AppleScript Language Guide, except that the Finder's Make command can't set the value of the new object's data unless the new object is an alias file.

make [ new ] className [ at referenceToContainer ]         �
   [ with properties                                       �
      { propertyLabel:propertyValue [, propertyLabel:propertyValue ]...}]�
   [ ( to | with data ) referenceToObject ]
The class of the object to be created. (Note that if you are creating a new file, you cannot use the optional term new
before className.)
Class: Class identifier
The container in which to create the new object.
Class: Reference
Default value: The Finder's current insertion location
The name of a property whose value is to be set.
Class: String
The value to assign to the property.
Class: The value class of the property as specified in the object class definition in Chapter 2, "Finder Objects," or a value that can be coerced to the class of the property
Default value: If you create a file or folder without specifying
its name, the Finder creates a an item named Untitled File or Untitled Folder. Other property values, such as the creation date, icon, and so on, are provided by the Finder on the basis
of information in the operating environment.
A reference to the object or objects to which you want to make an alias. This parameter is meaningful only if you are making
a new alias.
Class: Reference or list of references to the object or objects for which aliases are to be made
Default value: None
A reference to the newly created object.

The script that follows creates a new folder named My Folder at the top level of the startup disk.

tell application "Finder"
   make new folder at startup disk with properties �
      {name: "My Folder"}
end tell
If you save this script as an application, it makes an alias file on the desktop for any objects whose icon you drop onto the script's icon.

on open x
   repeat with i in x
      tell application "Finder"
         make alias file to i
      end tell
   end repeat
end open
If you save this script as an application and drag a folder onto the application's icon, the script searches the entire startup disk for any items whose names include the name of the folder and creates alias files in that folder for all matching items:

on open x
   tell application "Finder"
      repeat with i in x
         set n to name of i
         open i
         make alias file to every item of entire contents �
            of startup disk whose name contains n at i
      end repeat
   end tell
end open 
This script may take a minute or more to run if the startup disk contains a large number of items.

When you use the Make command to create a new file, you can't use the term new before the term file:

tell application "Finder"
   make file at startup disk with properties �
      {name: "My File"}
end tell
For all other object classes, the term new is optional.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996