Table of Contents

Templator is a PowerScript to automatically open document templates, specifically for creating proof and approvals for customers.

Templator will

Typical uses

Quick Create Tab

This tab lists the previously saved settings, double-click to load the template settings and create a template.

Template Options Tab

Template

Placement


Find and Replace

Once the template is opened or embedded you can find and replace text in the template. Note: This will not work on placed documents as they are not editable


Size formatting

You can format the height, width and scale in the Default Text/Format column

The formatting is “units,decimals,scale”

Examples


Javascript

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.

Your code must return the standard object indicating success and any error messages/text changes, see the next section.

Warning: Make sure your code is self-contained and does not pollute the global scope

ExtendScript in Illustrator
Extendscript Example

var d = new Date;
var success = false;

data.textChanges.push({find: "{filename}", type: "activeDocument.name"});
data.textChanges.push({find: "*year*", type: "text", value: d.getFullYear()});

if(success){
    return {
        success: true,
        data: data
    };
}

return {
    success: true,
    errorMessage: 'No custom code setup'
};

Javascript in CEP/NodeJS
Javascript/Node Async Example

return function getWebsite(data, callback){
     $.get("https://www.google.com",function(html){
         data.textChanges.push({find: "{html}", type: "text", value: html });
         callback({ success: true, data: data });
     });
}


External Data

This gives you the option of retrieving data from an external source, such as a custom webpage linked to a database to Find and Replace text.

The server must return data in the following JSON object, see below


External URL and Javascript Return Data Format

The Javascript Extendscript must return the following, and the external webpage must return this in JSON.

{
    success: true|false,
    errorMessage: string,
    data: {
         textChanges: [
              {find: "{{animal}}": type: "text", value: "Cat" }
         ]
    }


Artwork

This option allows you to copy the currently selected artwork to the template and resize it. This has been designed for creating approval forms.


Folders


Save

Saves the document as an Illustrator file


Export PDF

Exports the document as an Illustrator file


Export Image

Exports the Template Artboard as an Image

Date Formats

Mask Description
d Day of the month as digits; no leading zero for single-digit days.
dd Day of the month as digits; leading zero for single-digit days.
ddd Day of the week as a three-letter abbreviation.
dddd Day of the week as its full name.
m Month as digits; no leading zero for single-digit months.
mm Month as digits; leading zero for single-digit months.
mmm Month as a three-letter abbreviation.
mmmm Month as its full name.
yy Year as last two digits; leading zero for years less than 10.
yyyy Year represented by four digits.
h Hours; no leading zero for single-digit hours (12-hour clock).
hh Hours; leading zero for single-digit hours (12-hour clock).
H Hours; no leading zero for single-digit hours (24-hour clock).
HH Hours; leading zero for single-digit hours (24-hour clock).
M Minutes; no leading zero for single-digit minutes.
MM Minutes; leading zero for single-digit minutes.
N ISO 8601 numeric representation of the day of the week.
o GMT/UTC timezone offset, e.g. -0500 or +0230.
s Seconds; no leading zero for single-digit seconds.
ss Seconds; leading zero for single-digit seconds.
S The date's ordinal suffix (st, nd, rd, or th). Works well with d.
l Milliseconds; gives 3 digits.
L Milliseconds; gives 2 digits.
t Lowercase, single-character time marker string: a or p.
tt Lowercase, two-character time marker string: am or pm.
T Uppercase, single-character time marker string: A or P.
TT Uppercase, two-character time marker string: AM or PM.
W ISO 8601 week number of the year, e.g. 42
Z US timezone abbreviation, e.g. EST or MDT. With non-US timezones or in the
'…', ”…” Literal character sequence. Surrounding quotes are removed.
UTC: Must be the first four characters of the mask. Converts the date from local time to UTC/GMT/Zulu time before applying the mask. The “UTC:” prefix is removed.

Unit Formats

Abbreviation Singular Plural note
ft foot feet
yd yard yards
mi mile miles
mm millimeter millimeters
cm centimeter centimeters
m meter meters
km kilometer kilometers
pt point points inches / 72
pc pica picas points * 12
tpt traditional point traditional points inches / 72.27
tpc traditional pica traditional picas 12 tpt
ci cicero ciceros 12.7872 pt

User Text Input Validation

For User Text inputs you can validate the form using the following rules. Rules are separated by commas. for example “required,min:0,max:100,type:number”

Release Notes

Version 2.0.0

Version 1.3.0