The module that allows access to specialized commands within the application. Various application state can be modified or queried here.
Copied to your clipboardvar PhotoshopCore = require('photoshop').core;
Index
Functions
- calculateDialogSize
- endModalToolState
- getActiveTool
- getMenuCommandState
- getMenuCommandTitle
- performMenuCommand
- showAlert
Functions
calculateDialogSize
▸ calculateDialogSize(preferredSize: object, identifier?: string, minimumSize?: object): Promise‹object›
Returns the effective size of a dialog.
Copied to your clipboard1var idealSize = { width: 200, height: 500 }2{ width, height} = await PhotoshopCore.calculateDialogSize(idealSize)
Parameters:
▪ preferredSize: object
| Name | Type | 
|---|---|
| height | number | 
| width | number | 
▪Optional  identifier: string
▪Optional  minimumSize: object
| Name | Type | 
|---|---|
| height | number | 
| width | number | 
endModalToolState
▸ endModalToolState(commit: boolean): Promise‹void›
End the current modal tool editing state.
Copied to your clipboard1// close the modal dialog, cancelling changes2await PhotoshopCore.endModalToolState(false)
Parameters:
| Name | Type | 
|---|---|
| commit | boolean | 
getActiveTool
▸ getActiveTool(): Promise‹object›
Returns information about the active Photoshop tool.
Copied to your clipboard{ title } = await PhotoshopCore.getActiveTool()
getMenuCommandState
▸ getMenuCommandState(options: object): Promise‹boolean›
Returns whether a command menu item is available for invoking.
Copied to your clipboard1// can a Fill be performed?2var canFill = await PhotoshopCore.getMenuCommandState({ commandID: 1042 })
Parameters:
▪ options: object
| Name | Type | 
|---|---|
| commandID | number | 
| scheduling? | Scheduling | 
getMenuCommandTitle
▸ getMenuCommandTitle(options: object): Promise‹string›
Returns the localized menu title of the menu command item.
Copied to your clipboardvar renameLayerStr = await PhotoshopCore.getMenuCommandTitle({ commandID: 2983 })
Parameters:
▪ options: object
| Name | Type | 
|---|---|
| commandID? | number | 
| menuID? | number | 
| scheduling? | Scheduling | 
performMenuCommand
▸ performMenuCommand(options: object): Promise‹boolean›
Invokes the menu command via its commandID. Returns false
on failure, or if the command is not available.
Copied to your clipboard1// select all2await PhotoshopCore.performMenuCommand({ commandID: 1017 })
Parameters:
▪ options: object
| Name | Type | 
|---|---|
| commandID | number | 
| scheduling? | Scheduling | 
showAlert
▸ showAlert(options: object): Promise‹void›
Show a generic alert box to the user. 'OK' to dismiss.
Copied to your clipboard1// script has completed.2await PhotoshopCore.showAlert({ message: 'Operation successful'})
Parameters:
▪ options: object
| Name | Type | 
|---|---|
| message | string | 
