We’re here to help

Scripting the Twixl Publisher plug-in

Follow

This article expects that you are familiar with Adobe's ExtendScript scripting language.

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)

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
  • Panorama: Rectangle

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
Panorama (< 5.1.5)
com.rovingbird.epublisher.panorama

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);

Property overview

The properties that are available for a slide show are:

{
    '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,
}

For a webviewer, the properties are as follows:

{
    'wvUrl':                  '',
    'wvAllowUserInteraction': false,
    'wvTransparent':          false,
    'wvScaleToFit':           false,
    'wvShowScrollbars':       false,
    'wvOpenLinksInline':      true,
    'wvShowLoadingIndicator': false,
}

For a web overlay:

{
    'woUrl':                  '',
    'woAllowUserInteraction': false,
    'woWidth':                '',
    'woHeight':               '',
    'woShowScrollbars':       false,
    'woShowLoadingIndicator': false,
    'woBackgroundColor':      '000000',
    'woBackgroundOpacity':    50,
    'woAnalyticsName':        '',
    'woScaleToFit':           false,
}

For scrollable content, we have:

{
    'scAllowScrolling': false,
    'scShowScrollbars': true,
    'scEnablePaging':   false,
    'scEnableZooming':  false,
}

For movies:

{
    'movieAutoStart':           false,
    'movieShowController':      false,
    'movieLoop':                false,
    'movieShowFullScreen':      false,
    'movieReturnToPosterFrame': false,
    'movieAnalyticsName':       '',
}

For sound:

{
    'soundAutoStart':     false,
    'soundLoop':          false,
    'soundAnalyticsName': '',
}

For full screen images:

{
    'imageAllowFullScreen': false,
    'imageAnalyticsName':   '',
}

For image sequences:

{
    'isqFolder':        '',
    'isqReverse':       false,
    'isqAnalyticsName': '',
}

For panoramas:

{
    'panoramaFolder':    '',
    'panoramaFovStart':  70,
    'panoramaFovMin':    5,
    'panoramaFovMax':    120,
    'panoramaPanMin':    0,
    'panoramaPanMax':    360,
    'panoramaPanStart':  0,
    'panoramaTiltMin':   -90,
    'panoramaTiltMax':   90,
    'panoramaTiltStart': 0,
}

 

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.

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

Comments

0 comments

Please sign in to leave a comment.