adobe-cep-core - v1.0.37

# adobe-cep-core - v1.0.37

## Table of contents

### Namespaces

- [ae](modules/ae.md)
- [ame](modules/ame.md)
- [au](modules/au.md)
- [pr](modules/pr.md)
- [ps](modules/ps.md)

### Classes

- [Encoding](classes/Encoding.md)
- [FS](classes/FS.md)
- [Process](classes/Process.md)
- [Util](classes/Util.md)

### Type Aliases

- [ErrorResult](README.md#errorresult)
- [LastErrorResult](README.md#lasterrorresult)

### Variables

- [EVENT\_TYPES](README.md#event_types)
- [cep](README.md#cep)
- [eventBus](README.md#eventbus)

### Functions

- [addEventListener](README.md#addeventlistener)
- [closeExtension](README.md#closeextension)
- [dispatchEvent](README.md#dispatchevent)
- [downloadFile](README.md#downloadfile)
- [evalScript](README.md#evalscript)
- [getErrorResult](README.md#geterrorresult)
- [getLastError](README.md#getlasterror)
- [getSystemPath](README.md#getsystempath)
- [getWindowTitle](README.md#getwindowtitle)
- [isWindows](README.md#iswindows)
- [loadJsxFile](README.md#loadjsxfile)
- [openURLInDefaultBrowser](README.md#openurlindefaultbrowser)
- [registerKeyEventsInterest](README.md#registerkeyeventsinterest)
- [removeEventListener](README.md#removeeventlistener)
- [requestOpenExtension](README.md#requestopenextension)
- [setWindowTitle](README.md#setwindowtitle)
- [showOpenDialog](README.md#showopendialog)
- [showSaveDialog](README.md#showsavedialog)

## Type Aliases

### ErrorResult

Ƭ **ErrorResult**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `err` | [`LastErrorResult`](README.md#lasterrorresult) |

#### Defined in

types/CEPEngine_extensions.ts:2

___

### LastErrorResult

Ƭ **LastErrorResult**: `number`

#### Defined in

types/CEPEngine_extensions.ts:1

## Variables

### EVENT\_TYPES

• `Const` **EVENT\_TYPES**: typeof `EventType` = `EventType`

事件列表

#### Defined in

core/common/index.ts:328

___

### cep

• **cep**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `encoding` | [`Encoding`](classes/Encoding.md) |
| `fs` | [`FS`](classes/FS.md) |
| `process` | [`Process`](classes/Process.md) |
| `util` | [`Util`](classes/Util.md) |

#### Defined in

types/CEPEngine_extensions.ts:532

___

### eventBus

• `Const` **eventBus**: `EventEmitter`

事件监听与派发

#### Defined in

core/common/index.ts:322

## Functions

### addEventListener

▸ **addEventListener**(`type`, `listener`, `obj?`): `void`

Registers an interest in a CEP event of a particular type, and
assigns an event handler.
The event infrastructure notifies your extension when events of this type occur,
passing the event object to the registered handler function.

#### Parameters

| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| `type` | `string` | `undefined` | The name of the event type of interest. |
| `listener` | `Function` | `undefined` | The JavaScript handler function or method. |
| `obj` | ``null`` \| { `handler`: `Function`  } | `null` | Optional, the object containing the handler method, if any.          Default is null. |

#### Returns

`void`

#### Defined in

core/common/index.ts:199

___

### closeExtension

▸ **closeExtension**(): `void`

Closes this extension.

#### Returns

`void`

#### Defined in

core/common/index.ts:249

___

### dispatchEvent

▸ **dispatchEvent**(`event`): `void`

Triggers a CEP event programmatically. Yoy can use it to dispatch
an event of a predefined type, or of a type you have defined.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `event` | `CSEvent` | A \c CSEvent object. |

#### Returns

`void`

#### Defined in

core/common/index.ts:229

___

### downloadFile

▸ **downloadFile**(`from`, `to?`): `string`

下载文件

**`Export`**

#### Parameters

| Name | Type |
| :------ | :------ |
| `from` | `string` |
| `to?` | `string` |

#### Returns

`string`

#### Defined in

core/common/index.ts:314

___

### evalScript

▸ **evalScript**(`script`): `Promise`<`string`\>

执行jsx代码片段

**`Export`**

#### Parameters

| Name | Type |
| :------ | :------ |
| `script` | `string` |

#### Returns

`Promise`<`string`\>

#### Defined in

core/common/index.ts:300

___

### getErrorResult

▸ **getErrorResult**(): [`ErrorResult`](README.md#errorresult)

#### Returns

[`ErrorResult`](README.md#errorresult)

#### Defined in

types/CEPEngine_extensions.ts:6

___

### getLastError

▸ **getLastError**(): [`LastErrorResult`](README.md#lasterrorresult)

#### Returns

[`LastErrorResult`](README.md#lasterrorresult)

#### Defined in

types/CEPEngine_extensions.ts:4

___

### getSystemPath

▸ **getSystemPath**(`pathType`): `string`

Retrieves a path for which a constant is defined in the system.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `pathType` | `string` | The path-type constant defined in \c #SystemPath userData\|commonFiles\|myDocuments\|extension\|hostApplication, |

#### Returns

`string`

The platform-specific system path string.

#### Defined in

core/common/index.ts:260

___

### getWindowTitle

▸ **getWindowTitle**(): `string`

Get the title of the extension window.
This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver.

Since 6.1.0

#### Returns

`string`

The window title.

#### Defined in

core/common/index.ts:172

___

### isWindows

▸ **isWindows**(): `boolean`

判断是否是在windows系统

**`Export`**

#### Returns

`boolean`

#### Defined in

core/common/index.ts:270

___

### loadJsxFile

▸ **loadJsxFile**(`path`): `Promise`<`string`\>

加载jsx代码文件

**`Export`**

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `path` | `string` | jsx 路径或者目录 |

#### Returns

`Promise`<`string`\>

#### Defined in

core/common/index.ts:282

___

### openURLInDefaultBrowser

▸ **openURLInDefaultBrowser**(`url`): `number`

Opens a page in the default system browser.

Since 4.2.0

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `url` | `string` | The URL of the page/file to open, or the email address.  Must use HTTP/HTTPS/file/mailto protocol. For example:    "http://www.adobe.com"    "https://github.com"    "file:///C:/log.txt"    "mailto:test@adobe.com" |

#### Returns

`number`

One of these error codes:
     <ul>
         <li>NO_ERROR - 0</li>
         <li>ERR_UNKNOWN - 1</li>
         <li>ERR_INVALID_PARAMS - 2</li>
         <li>ERR_INVALID_URL - 201</li>
     </ul>

#### Defined in

core/common/index.ts:27

___

### registerKeyEventsInterest

▸ **registerKeyEventsInterest**(`keyEventsInterest`): `any`

Register an interest in some key events to prevent them from being sent to the host application.

This function works with modeless extensions and panel extensions.
Generally all the key events will be sent to the host application for these two extensions if the current focused element
is not text input or dropdown,
If you want to intercept some key events and want them to be handled in the extension, please call this function
in advance to prevent them being sent to the host application.

Since 6.1.0

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `keyEventsInterest` | `string` | A JSON string describing those key events you are interested in. A null object or                                  an empty string will lead to removing the interest    This JSON string should be an array, each object has following keys:    keyCode:  [Required] represents an OS system dependent virtual key code identifying            the unmodified value of the pressed key.  ctrlKey:  [optional] a Boolean that indicates if the control key was pressed (true) or not (false) when the event occurred.  altKey:   [optional] a Boolean that indicates if the alt key was pressed (true) or not (false) when the event occurred.  shiftKey: [optional] a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred.  metaKey:  [optional] (Mac Only) a Boolean that indicates if the Meta key was pressed (true) or not (false) when the event occurred.                       On Macintosh keyboards, this is the command key. To detect Windows key on Windows, please use keyCode instead.  An example JSON string:    [      {          "keyCode": 48      },      {          "keyCode": 123,          "ctrlKey": true      },      {          "keyCode": 123,          "ctrlKey": true,          "metaKey": true      }  ] |

#### Returns

`any`

#### Defined in

core/common/index.ts:160

___

### removeEventListener

▸ **removeEventListener**(`type`, `listener`, `obj?`): `void`

Removes a registered event listener.

#### Parameters

| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| `type` | `string` | `undefined` | The name of the event type of interest. |
| `listener` | `Function` | `undefined` | The JavaScript handler function or method that was registered. |
| `obj` | ``null`` \| { `handler`: `Function`  } | `null` | Optional, the object containing the handler method, if any.           Default is null. |

#### Returns

`void`

#### Defined in

core/common/index.ts:215

___

### requestOpenExtension

▸ **requestOpenExtension**(`extensionId`, `params`): `void`

Loads and launches another extension, or activates the extension if it is already loaded.

**`Example`**

```ts
To launch the extension "help" with ID "HLP" from this extension, call:
<code>requestOpenExtension("HLP", ""); </code>
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `extensionId` | `string` | The extension's unique identifier. |
| `params` | `string` | - |

#### Returns

`void`

#### Defined in

core/common/index.ts:244

___

### setWindowTitle

▸ **setWindowTitle**(`title`): `void`

Set the title of the extension window.
This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver.

Since 6.1.0

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `title` | `string` | The window title. |

#### Returns

`void`

#### Defined in

core/common/index.ts:184

___

### showOpenDialog

▸ **showOpenDialog**(`allowMultipleSelection`, `chooseDirectory`, `title`, `initialPath`, `fileTypes`, `friendlyFilePrefix`, `prompt`): `Object`

Displays the OS File Open dialog, allowing the user to select files or directories.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `allowMultipleSelection` | `boolean` | When true, multiple files/folders can be selected. |
| `chooseDirectory` | `boolean` | When true, only folders can be selected. When false, only         files can be selected. |
| `title` | `string` | Title of the open dialog. |
| `initialPath` | `string` | Initial path to display in the dialog. Pass NULL or "" to         display the last path chosen. |
| `fileTypes` | `string`[] | The file extensions (without the dot) for the types       of files that can be selected. Ignored when chooseDirectory=true. |
| `friendlyFilePrefix` | `string` | String to put in front of the extensions       of files that can be selected. Ignored when chooseDirectory=true. (win only)       For example:           fileTypes = ["gif", "jpg", "jpeg", "png", "bmp", "webp", "svg"];           friendlyFilePrefix = "Images (*.gif;*.jpg;*.jpeg;*.png;*.bmp;*.webp;*.svg)"; |
| `prompt` | `string` | String for OK button (mac only, default is "Open" on mac, "Open" or "Select Folder" on win). |

#### Returns

`Object`

An object with these properties:
     <ul><li>"data": An array of the full names of the selected files.</li>
         <li>"err": The status of the operation, one of
         <br>NO_ERROR
         <br>ERR_INVALID_PARAMS </li>
     </ul>

| Name | Type |
| :------ | :------ |
| `data` | `string`[] |
| `err` | [`LastErrorResult`](README.md#lasterrorresult) |

#### Defined in

core/common/index.ts:56

___

### showSaveDialog

▸ **showSaveDialog**(`title`, `initialPath`, `fileTypes`, `defaultName`, `friendlyFilePrefix`, `prompt`, `nameFieldLabel`): `Object`

Displays the OS File Save dialog, allowing the user to type in a file name.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `title` | `string` | Title of the save dialog. |
| `initialPath` | `string` | Initial path to display in the dialog. Pass NULL or "" to         display the last path chosen. |
| `fileTypes` | `string`[] | The file extensions (without the dot) for the types       of files that can be selected. |
| `defaultName` | `string` | String to start with for the file name. |
| `friendlyFilePrefix` | `string` | String to put in front of the extensions of files that can be selected. (win only)       For example:           fileTypes = ["gif", "jpg", "jpeg", "png", "bmp", "webp", "svg"];           friendlyFilePrefix = "Images (*.gif;*.jpg;*.jpeg;*.png;*.bmp;*.webp;*.svg)"; |
| `prompt` | `string` | String for Save button (mac only, default is "Save" on mac and win). |
| `nameFieldLabel` | `string` | String displayed in front of the file name text field (mac only, "File name:" on win). |

#### Returns

`Object`

An object with these properties:
     <ul><li>"data": The file path selected to save at or "" if canceled</li>
         <li>"err": The status of the operation, one of
         <br>NO_ERROR
         <br>ERR_INVALID_PARAMS </li>
     </ul>

| Name | Type |
| :------ | :------ |
| `data` | `string` |
| `err` | [`LastErrorResult`](README.md#lasterrorresult) |

#### Defined in

core/common/index.ts:99
