Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
templator [2022/06/06 04:21] – [Javascript] o2wiki | templator [2022/06/06 04:32] – o2wiki | ||
---|---|---|---|
Line 7: | Line 7: | ||
* Copy the selected artwork in the current document and place it on the template, and rasterize it. | * Copy the selected artwork in the current document and place it on the template, and rasterize it. | ||
* Ask the user for custom information, | * Ask the user for custom information, | ||
+ | * **(NEW) Run Javascript to fetch additional data** | ||
* Automatically replace text in the document such as date, name and any other text you want | * Automatically replace text in the document such as date, name and any other text you want | ||
* Connect to a URL to get information from a website or database, for example, enter in a job number and return the job name and customer details | * Connect to a URL to get information from a website or database, for example, enter in a job number and return the job name and customer details | ||
Line 108: | Line 109: | ||
==== Javascript ==== | ==== Javascript ==== | ||
- | You can run Extendscript or Javascript to modify the document and return additional text changes to Templator. Your code will b wrapped in a function so ensure that you include a return statement with the required data structure. | + | You can run Extendscript or Javascript to modify the document and return additional text changes to Templator. Your code will be wrapped in a function so ensure that you include a return statement with the required data structure. |
- | + | ||
- | * **ExtendScript in Illustrator** | + | |
- | * Runs the code in Extendscript in Illustrator allowing you to modify and get information from the document. | + | |
- | * Note that ExtendScript and not modern ES6 Javascript and does not support the latest features of Javascript. see[[ https:// | + | |
- | * ** Javascript in CEP/NodeJS ** | + | |
- | * Runs the code in the CEP Panel of PowerScripts, | + | |
- | * Note that the following libraries are already loaded CSInterface, | + | |
- | * You can run ExtendScript code using CSInterface.evalScript. | + | |
- | * To asynchronously get data, return a Function, This function will be called with the first argument data and the second a callback | + | |
- | * **Warning: Make sure your code is self-contained and does not pollute the global scope** | + | |
Your code must return the standard object indicating success and any error messages/ | Your code must return the standard object indicating success and any error messages/ | ||
+ | |||
+ | **Warning: Make sure your code is self-contained and does not pollute the global scope** | ||
+ | |||
+ | ==ExtendScript in Illustrator== | ||
+ | * Runs the code in Extendscript in Illustrator allowing you to modify and get information from the document. | ||
+ | * Note that ExtendScript and not modern ES6 Javascript and does not support the latest features of Javascript. see[[ https:// | ||
== Extendscript Example == | == Extendscript Example == | ||
Line 142: | Line 139: | ||
}; | }; | ||
</ | </ | ||
+ | |||
+ | == Javascript in CEP/NodeJS == | ||
+ | * Runs the code in the CEP Panel of PowerScripts, | ||
+ | * Note that the following libraries are already loaded CSInterface, | ||
+ | * You can run ExtendScript code using CSInterface.evalScript. | ||
+ | * To asynchronously get data, return a Function, This function will be called with the first argument data and the second a callback | ||
== Javascript/ | == Javascript/ | ||
<sxh javascript; > | <sxh javascript; > | ||
return function getWebsite(data, | return function getWebsite(data, | ||
- | | + | |
| | ||
| |