ImportOptions object
The ImportOptions object encapsulates the options used to import a file with the Project.importFile methods. See “Project importFile() method” on page 118.
The constructor takes an optional parameter, an ExtendScript File object for the file. If it is not supplied, you must explicitly set the value of the file attribute before using the object with the importFile method.
Syntax
new ImportOptions();
new ImportOptions(file);
Example
new ImportOptions().file = new File("myfile.psd");
Attribute List
| Attributes | Reference | Description |
|---|---|---|
| importAs | “ImportOptions importAs attribute” on page 76 | The type of file to be imported. |
| sequence | “ImportOptions sequence attribute” on page 77 | When true, import a sequence of files, rather than an individual file. |
| forceAlphabetical | “ImportOptions forceAlphabetical attribute” on page 76 | When true, the “Force alphabetical order” option is set. |
| file | “ImportOptions file attribute” on page 76 | The file to import, or the first file of the sequence to import. |
Method List
| Method | Reference | Description |
|---|---|---|
| canImportAs() | “ImportOptions canImportAs() method” on page 75 | Restricts input to a particular file type. |
Detailed Descriptions
canImportAs() method
Syntax: importOptions.canImportAs(type)
Description: Reports whether the file can be imported as the source of a particular object type. If this method returns true, you can set the given type as the value of the importAs attribute. See “ImportOptions importAs attribute” on page 76.
Parameters: type The type of file that can be imported. An ImportAsType enumerated value; one of:
- ImportAsType.COMP
- ImportAsType.FOOTAGE
- ImportAsType.COMP_CROPPED_LAYERS
- ImportAsType.PROJECT
Returns: Boolean.
Example:
var io = new ImportOptions(File(“c:\\myFile.psd”));
if io.canImportAs(ImportAsType.COMP);
io.importAs = ImportAsType.COMP;
file attribute
Syntax: importOptions.file
Description: The file to be imported. If a file is set in the constructor, you can access it through this attribute.
Type: ExtendScript File object; read/write.
forceAlphabetical attribute
Syntax: importOptions.forceAlphabetical
Description: When true, has the same effect as setting the “Force alphabetical order” option in the File > Import > File dialog box.
Type: Boolean; read/write.
importAs attribute
Syntax: importOptions.importAs
Description: The type of object for which the imported file is to be the source. Before setting, use canImportAs to check that a given file can be imported as the source of the given object type. See “ImportOptions canImportAs() method” on page 75.
Type: An ImportAsType enumerated value; read/write. One of:
- ImportAsType.COMP_CROPPED_LAYERS
- ImportAsType.FOOTAGE
- ImportAsType.COMP
- ImportAsType.PROJECT
sequence attribute
Syntax: importOptions.sequence
Description: When true, a sequence is imported; otherwise, an individual file is imported.
Type: Boolean; read/write.