AutoTask Value Substitution

Overview

  • Allows token substitution in certain AutoTask fields, specifically in <modification> and <export> items
  • Creates a way to make value mappings for token substitution
  • Ensures that category and formatFamily token values can be narrowed to single values if they are being used in token substitutions

Design

This is the definition of the new definition block where tokens are mapped, new tokens are defined, and rules are specified for unique category and formatFamily values.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!--
    Tokens automatically defined by the system
      User defined attributes
        attribute.*
      Asset values
        asset.name
        asset.description
        asset.fileName
        asset.fileSize
        asset.fileWidth
        asset.fileHeight
        asset.fileType
        asset.assetId
        asset.creationDate
        asset.modificationDate
        asset.importDate
        asset.formatFamily
        asset.visible
      User values
        user.id
        user.firstname
        user.lastname
        user.userLabel
        user.email
        user.login
      Task values
        task.name (from <task name="...">)
        task.timestamp
      Category values
        category.id
        category.name
        category.path
-->
<dictionary>
    <!--
         Maps values in specific tokens
    -->
    <substitutions>
        <substitute token="attribute.Status" valueIn="true" valueOut="Done"/>
        <substitute token="attribute.Status" valueIn="false" valueOut="Not done"/>
 
 
        <substitute token="attribute.DayOfWeek" valueIn="Mon" valueOut="Monday"/>
        <substitute token="attribute.DayOfWeek" valueIn="Tue" valueOut="Tuesday"/>
 
 
        <substitute token="asset.filetype" valueIn="indd" valueOut="InDesign Document"/>
        <substitute token="asset.filetype" valueIn="psd" valueOut="PhootoShop Document"/>
    </substitutions>
 
 
    <!--
         Kills the task if can't be narrowed to one -- implies that this must be defined if using category.path or category.name,
         or category.id. The category list may be narrowed by specifying a specific parent, or by a regex matching rule, or both.
         The regex is a simple match. If there are multiple matches, the task will not run.
    -->
    <categoryUniquenessRule parent="level1/level2" regex="@#$@#$"/>
 
 
    <!--
         Kills the task if can't be narrowed to one -- implies that this must be defined if using asset.formatFamily. The comma
         separated list in approvedList specifies the allowed format families. If an asset is a member of several families,
         the first family in the approved list will be chosen for the value.
    -->
    <formatFamilyUniquenessRule orderedApprovedList="image,video,audio,document"/>
 
 
    <!--
         Creates a new token, called 'trickyPathModification' which takes the path and uses some fancy regex to do something to it.
         A regex must have one and only one matching group, which will be used for the value of the new token. If the token contained
         in the source attribute isn't defined, the task is killed. Also, if the token name is already in use, the task killed. Also,
         if the regular expression is applied to the value of the source token, and no matching group is found (or the match is an empty
         string), the task will be killed.
    -->
    <definitions>
        <define name="trickyPathModificationPart1" source="category.path" regex="Find first chunk of path"/>
        <define name="trickyPathModificationPart2" source="category.path" regex="Find second chunk of path"/>
    </definitions>
</dictionary>
 
 
<export type="path" path="/tmp/blah/${trickyPathModificationPart1}/${attribute.DayOfWeek}/${trickyPathModificationPart2}"/>

 Following is a list of places where it is legal to use token substitutions:

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<modify type="category" path="/${someToken}" add="true"/>
<modify type="attribute" name="${someToken}" value="${someToken}"/>
<modify type="attribute" copyFromAttribute="${someToken}" name="name"/>
<modify type="attribute" name="description" value="that" regex="${someToken}"/>
  
<repurpose crop="${someToken}" format="${someToken}" presetProcess="${someToken}" quality="${someToken}" videoPreset="${someToken}"/>
 
<export type="path" path="/tmp/${someToken}" name="${someOtherToken}"/>
<export type="asset" category="/Stuff/Things/${someToken}"/>
<export type="view" name="${someToken}"/>
 
<notify address="${someToken}" emailTemplate="${someToken}" groupName="${someToken}" objectName="${someToken}" path="${someToken}" soapAction="${someToken}" url="${someToken}"/>
 
<customJob className="com.netxposure.wash.my.socks" amountOfCleaning="${someToken}" washBothAtOnce="${someToken}"/>

Order of Operations

In building the token dictionary:

  1. Process uniqueness rules
  2. Build attribute, asset, user, category, and task definitions
  3. Apply user defined substitution rules
  4. Add user defined definitions

Running a Task

  1. Build the dictionary using the context of the specific task (given asset, category, etc)
  2. Copy the Task object and do variable substitution on it
  3. Run the task

Notes about categoryUniquenessRule and formatFamilyUniquenessRule

We don't require either of these to be defined. If formatFamilyUniquenessRule is not defined, then asset.formatFamily will not be defined, and any attempt to use it will kill the task. Likewise, if categoryUniquenessRule is not defined, category.idcategory.name, and category.path will not be defined, and attempts to use them will kill the task.

We will kill the task in the following situations:

  1. categoryUniquenessRule is defined but is not sufficient to determine a single relevant category for the asset
  2. formatFamilyUniquenessRule is defined but is not sufficient to determine a single relevant format family for the asset
  3. categoryUniquenessRule is NOT defined, but category.pathcategory.name or category.id are used somewhere in the task
  4. formatFamilyUniquenessRule is NOT defined, but asset.formatFamily is used somewhere in the task

We will not kill the task if either or both are defined, but there is not an asset in the event context (i.e. it's a timer task, a dataset task, etc.)

 

Was this article helpful?
0 out of 0 found this helpful