Documents
A collections class allowing for array access into the application's
list of documents that are currently open,
while also providing familiar methods from ExtendScript, like getByName
.
Copied to your clipboard1// Iterate through all the documents2app.documents.forEach(h => console.log(h.title));
Indexable
▪ [index: number]: Document
Used to access the documents in the collection.
Copied to your clipboard1// Iterate through all the documents2app.documents.forEach(h => console.log(h.title));
Properties
名称 | 类型 | 访问 | 最低版本 | 描述 |
---|---|---|---|---|
length | number | R | 22.5 | Number of Document elements in this collection. |
parent | Photoshop | R | 22.5 | The owner application of this Documents collection. |
typename | string | R | 22.5 | The name for this object collection: Documents. |
Methods
add
22.5async : Promise<Document>
Create a new document.
No options will create a document of 7 x 5 inches at 300 pixels per inch. This is the same as the "Default Photoshop Size" preset.
An object with a 'preset' string parameter can be used to specify any of the other presets that come installed with Photoshop or created by users.
An object with one or more parameters can also be supplied. Any parameter missing will be set to the default of: width 2100 pixels, height 1500 pixels, resolution 300 pixels per inch, mode: @RGBColorMode and a fill of white with no transparency.
Copied to your clipboard1// "Default Photoshop Size" 7x5 inches at 300ppi2let newDoc1 = await app.documents.add();3let newDoc2 = await app.documents.add({4 width: 800,5 height: 600,6 resolution: 300,7 mode: "RGBColorMode",8 fill: "transparent"9});10let newDoc3 = await app.documents.add({preset: "My Default Size 1"});
Parameters
名称 | 类型 | 描述 |
---|---|---|
options? | DocumentCreateOptions | @DocumentCreateOptions |
getByName
22.5Find the first document with the matching name.
Parameters
名称 | 类型 |
---|---|
name | string |