In this article, the InDesign scripting events are shown that are available for Assets for InDesign.
Application
Methods
elvisPostRequest
- Returns: A string with the result of the request.
- Description: This method will perform a PostRequest (REST API) on Assets Server with the passed path and query.
Parameter | Type | Description | Required? |
---|---|---|---|
requestPath | String | The path of the request. Should start with '/'. | Yes |
queryArray | Array with arrays of 3 strings. | An array with arrays with strings for key, value and type (String or File) of the query parameters | Yes |
- Sample script:
Prerequisites: The user should be logged in. Script:
Result: An alert box with the json that describes all child folders and collections of the root folder of Assets Server. |
elvisGetRequest
- Returns: A string with the result of the request.
- Description: This method will perform a GetRequest (REST API) on Assets Server with the passed path and query.
Parameter | Type | Description | Required? |
---|---|---|---|
requestPath | String | The path of the request. Should start with '/'. | Yes |
queryArray | Array with arrays of 2 strings. | An array with arrays with strings for key and value of the query parameters. | Yes |
- Sample script:
Prerequisites: The user should be logged in. Script:
Result: An alert box with the json that describes the profile of the user. |
elvisOpenDocument
- Returns: The opened document.
- Description: Opens the document with the passed Assets ID.
Parameter | Type | Description | Required? |
---|---|---|---|
objectId | String | ID of the object to open. | Yes |
checkOutFile | Boolean | Checks-out the file from Assets Server when set to true. | Yes |
checkInOnClose | Boolean | Document will be checked in/undo checked out automatically during close. Default is false. | No |
showErrorMessages | Boolean | Should error messages been shown or not. Default is true. | No |
- Sample script:
Prerequisites: The user should be logged in. Script:
Result: The document with the passed ID is checked-out and opened. |
elvisOpenDocuments
- Returns: Nothing.
- Description: Opens the documents with the passed Assets ID. When users are not logged in they will be prompted to log in. After log on (also in case of SSO) the documents will be opened.
Parameter | Type | Description | Required? |
---|---|---|---|
objectIds | String | Array with the Elvis IDs of the objects to open. | Yes |
checkOutFile | Boolean | Checks-out the files from Assets Server when set to true. | Yes |
checkInOnClose | Boolean | Documents will be checked in/undo checked out automatically during close. Default is false. | No |
showErrorMessages | Boolean | Should error messages been shown or not. Default is true. | No |
- Sample script:
Prerequisites: The user should be logged in. Script:
Result: The documents with the passed IDs are checked-out and opened. |
Properties
assetsPreferences
- Returns: AssetsPreference
- Description: Assets Preferences settings.
- Access mode: Read-only
- Introduced in: Assets for InDesign 4.3.0.
woodwingLogging
- Returns: Boolean
- Description: Turns off and on WoodWing logging.
- Access mode: Read/write
- Sample script:
Prerequisites: None. Script:
Result: The WoodWing logging is enabled. |
AssetsPreference
Properties
useFileCache
- Returns: Boolean
- Description: Controls if downloaded files are kept in the cache when the layout is closed. Enabled by default.
- Access mode: Read/write
- Introduced in: Assets for InDesign 4.3.0.
- Sample script:
Prerequisites: None. Script:
Result: Downloaded files are kept in cache when the layout is closed. |
maxFileCacheSize
- Returns: Number.
- Description: Controls the maximum file size of the cache folder (in Gigabytes). The default size is 5GB.
- Access mode: Read/write
- Introduced in: Assets for InDesign 4.3.0.
- Sample script:
Prerequisites: None. Script:
Result: The maximum file size of the cache folder is set to 5GB. |
removeFileFromCacheAfter
- Returns: Number.
- Description: When files are kept in the cache, controls when a file is removed from the cache folder. The default period is 30 days after it has been added.
- Access mode: Read/write
- Introduced in: Assets for InDesign 4.3.0.
- Sample script:
Prerequisites: None. Script:
Result: A file is removed from the cache 30 days after it has been added. |
autoRelinkToAssetsWhenOpening
- Returns: Boolean.
- Description: Automatically link placed images with existing images in Assets Server. Disable this when automatic relinking needs to be turned off completely.
- Access mode: Read/write
- Introduced in: Assets for InDesign 4.3.0.
- Sample script:
Prerequisites: None. Script:
Result: Placed images are automatically linked with existing images in Assets Server. |
relinkBasedOnInstanceID
- Returns: Boolean.
- Description: Forces Assets Server to first search for files based on their Instance ID when automatically linking images is enabled. When nothing is found, a search is done based on the file name. The default value is 'false'.
- Access mode: Read/write
- Introduced in: Assets for InDesign 4.3.0.
- Sample script:
Prerequisites: None. Script:
Result: Assets Server is forced to first search for files based on their Instance ID when automatically linking images is enabled. |
doAutoLogIn
- Returns: Boolean.
- Description: Starts the log-in process to Assets Server when InDesign is started or a local document is opened. The default value is 'true'.
- Access mode: Read/write
- Introduced in: Assets for InDesign 4.3.0.
- Sample script:
Prerequisites: None. Script:
Result: The log-in process to Assets Server starts when InDesign is started or a local document is opened. |
Document
Methods
downloadElvisLinks
- Returns: Nothing
- Description: This method will make sure that the latest version of all linked files (stored in Assets Server) in the document are downloaded to the local machine. When a newer version of a file is downloaded then currently placed on the document, the link will be updated with this new version.
- Sample script:
Prerequisites: A document with at least one linked image that is not downloaded when opening the document, for example because the latest version was already placed on the document. Script:
Result: The latest versions of all linked files are downloaded to the Elvis Checkouts folder. When the version is newer than the version on the document the link is updated with the contents of the version. |
elvisCloseDocument
- Returns: Nothing
- Description: Closes and checks-in the document or performs an undo action of the check-out when needed. The document will not be saved before check-in.
Note: If you want to have a preview of the InDesign document you need to start InDesign Server with an extra '-preview' argument such as: 'InDesignServer -previews -port <...>'. Without this setting InDesign Server will not add a preview to the file and Assets Server will not be able to show a file preview.
Parameter | Type | Description | Required? |
---|---|---|---|
checkInFile | Boolean | Checks-in the file to Assets Server when set to true. * | Yes |
undoCheckOutFile | Boolean | Reverts the file check-out in Assets Server when set to true. * | Yes |
* When both checkInFile and undoCheckOutFile are set to true the file will be checked in.
- Sample script:
Prerequisites: An opened document that is stored in Assets Server. Script:
Result: The document will be checked-in and closed. The local file will be removed from disk. |
elvisFixXmpInfoOfPlacements
- Returns: Nothing
- Description: Fixes the XMP info that is stored in the document for all placements from Elvis.
- Sample script:
Prerequisites: An opened document that is stored in Assets Server. Script:
Result: A check is done for the presence of XMP info for all images that are placed from Assets Server. When the XMP Info is not available, the file is downloaded (when needed) and the XMP Info is applied. |
elvisRelinkAll
- Returns: Nothing
- Description: Relinks as many as possible placed files to files in Assets Server. Similar to the Relink All menu command.
- Sample script:
Prerequisites: An opened document that is stored in Assets Server. Script:
Result: The document will be checked-in and closed. The local file will be removed from disk. |
Properties
elvisId
- Returns: String
- Description: The Assets ID of the document. Returns an empty string when the document is not an Elvis document.
- Sample script:
Prerequisites: A document with at least one linked image that is stored in Assets Server. Script:
Result: The Assets ID of the document will be shown in an alert dialog. |
Link
Methods
downloadElvisLink
- Returns: Nothing
- Description: This method will make sure that the latest version of the linked file in Assets Server is downloaded to the local machine. When a newer version of the file is downloaded then is currently placed on the document, the link will be updated with this new version.
- Sample script:
Prerequisites: A document with at least one linked image stored in Assets Server that is not downloaded when opening the document, for example because the latest version was already placed on the document. Script:
Result: The latest versions of the first linked Assets file is downloaded to the Elvis Checkouts folder. When the version is newer than the version on the document the link is updated with the contents of the version. |
Properties
elvisId
- Returns: String
- Description: The Assets ID of the link. Returns an empty string when the link is not an Assets link.
- Access mode: Read-only
- Sample script:
Prerequisites: A document with at least one linked image stored in Assets Server. Script:
Result: Shows an alert with the ID of the link. |
elvisUrl
- Returns: String
- Description: The Assets URL of the link. Returns an empty string when the link is not an Assets link.
- Access mode: Read-only
- Sample script:
Prerequisites: A document with at least one linked image stored in Assets Server. Script:
Result: Shows an alert with the Assets Url of the link. |
elvisPath
- Returns: String
- Description: The path of the link in Assets Server. Returns an empty string when the link is not an Assets Server link.
- Access mode: Read-only
- Sample script:
Prerequisites: A document with at least one linked image stored in Assets Server. Script:
Result: Shows an alert with the path of the linked file. |
elvisFilePath
- Returns: String
- Description: The local file path of the link. Returns also a path for non-Assets links.
Note: This call is introduced because Link.filePath does not work for custom datalinks.
- Sample script:
Prerequisites: A document with at least one linked image stored in Assets Server. Script:
Result: Shows an alert with the path of the linked file. |
PageItem
Methods
elvisPlace
- Returns: Nothing
- Description: This method places an object in the page item using Assets Server that the user is logged on to.
Parameter | Type | Description | Required? |
---|---|---|---|
objectId | String | Assets ID of the object to place | Yes |
- Sample script:
Prerequisites: An opened or new document. Script:
Result: A page item will be created on the document and the file with the passed <Elvis_Id> will be placed into this frame. |
Comment
Do you have corrections or additional information about this article? Leave a comment! Do you have a question about what is described in this article? Please contact Support.
0 comments
Please sign in to leave a comment.