This article expects that you are familiar with Adobe's ExtendScript scripting language.
1. InDesign ExtendScript Labels
The way the Twixl Publisher plug-in stores the interactive properties is by attaching labels to the different elements.
Every object in Adobe InDesign can be provided with one or more labels via de ExtendScript function:
object.insertLabel(key, value)
To retrieve the label, you can use the extractLabel function using a specific key:
object.extractLabel(key)
2. Attaching properties
Here's an overview of the type of InDesign elements you can attach properties to, depending on the type of interactive element:
- Slide Show: MultiStateObject
- Web Viewer: Rectangle
- Web Overlay: Rectangle, TextFrame, PageItem
- Scrollable Content: Rectangle with one PageItem as its child element
- Full screen image: Graphic
- Movie: Movie
- Sound: Sound
- Image Sequence: Rectangle
3. Twixl Publisher interactive element keys
Every type of Twixl Publisher interactive element has its own key under which the properties are saved. Here's an overview:
Slide Show |
com.rovingbird.epublisher.mso |
Web Viewer |
com.rovingbird.epublisher.wv |
Web Overlay |
com.rovingbird.epublisher.wo |
Scrollable Content |
com.rovingbird.epublisher.sc |
Full screen image |
com.rovingbird.epublisher.image |
Movie |
com.rovingbird.epublisher.movie |
Sound |
com.rovingbird.epublisher.sound |
Image Sequence |
com.rovingbird.imagesequence |
4. JSON
Under these keys, all properties are saved in a JSON data structure. JSON (http://www.json.org) is a text based format which makes it very easy to store key/value structures.
var myProperties = { key1: “value", key2: “value", key3: “value" }; var myJsonString = JSON.stringify(myProperties); myObject.insertLabel("com.rovingbird.epublisher.mso", myJsonString);
To retrieve it later on, you can use the following code:
var myLabel = myObject.extractLabel("com.rovingbird.epublisher.mso"); var myProperties = JSON.parse(myLabel);
5. Property overview
5.1. Slide Show
{ 'msoShowScrollViewIndicator': false, 'msoAllowUserInteraction': false, 'msoShowScrollbars': false, 'msoAllowFullScreen': false, 'msoScrollViewIndicatorOpacity': 50, 'msoScrollViewIndicatorBackgroundColor': '000000', 'msoScrollViewIndicatorActiveColor': 'FFFFFF', 'msoScrollViewIndicatorInactiveColor': 'AAAAAA', 'msoFileFormat': 'PNG', 'msoFileFormatIdx': 0, 'msoFileFormatDesc': '', 'msoTransitionStyle': 'Push', 'msoTransitionStyleIdx': 0, 'msoAllowAutoPlay': false, 'msoInterval': 0, 'msoDelay': 0, 'msoTapPlayPause': false, 'msoAllowLoop': false, }
5.2. Web Viewer
{ 'wvUrl': '', 'wvAllowUserInteraction': false, 'wvTransparent': false, 'wvScaleToFit': false, 'wvShowScrollbars': false, 'wvOpenLinksInline': true, 'wvShowLoadingIndicator': false, }
5.3. Web Overlay
{ 'woUrl': '', 'woAllowUserInteraction': false, 'woWidth': '', 'woHeight': '', 'woShowScrollbars': false, 'woShowLoadingIndicator': false, 'woBackgroundColor': '000000', 'woBackgroundOpacity': 50, 'woAnalyticsName': '', 'woScaleToFit': false, }
5.4. Scrollable Content
{ 'scAllowScrolling': false, 'scShowScrollbars': true, 'scEnablePaging': false, 'scEnableZooming': false, }
5.5. Movies
{ 'movieAutoStart': false, 'movieShowController': false, 'movieLoop': false, 'movieShowFullScreen': false, 'movieReturnToPosterFrame': false, 'movieAnalyticsName': '', }
5.6. Sound
{ 'soundAutoStart': false, 'soundLoop': false, 'soundAnalyticsName': '', }
5.7. Full Screen Images
{ 'imageAllowFullScreen': false, 'imageAnalyticsName': '', }
5.8. Image Sequences
{ 'isqFolder': '', 'isqReverse': false, 'isqAnalyticsName': '', }
6. Automating preflight, export and preview
Download an example (for .article and .publication files) to see how the preflight, export and preview processes can be scripted: