WoodWing Help Center

Automatically deploying event scripts for Smart Connection 9 in InDesign or InCopy

Automatically deploying event scripts for Smart Connection 9 in InDesign or InCopy

Info: This feature requires Smart Connection for Adobe CC 2014 (10.0.1 or higher).

Event scripts in InDesign and InCopy can be used to automatically perform specific actions when an event takes place.

Examples:

  • The scripting event "afterOpenLayout" allows you to perform specific actions right after opening a layout in Enterprise, such as opening the Dossier panel to which the layout belongs.
  • The scripting event "afterLogOn" can be used to add custom menu commands when InDesign is started or right after logging in to Enterprise.

Note: Event scripts can be found on WoodWing Labs/Samples.

To help in the deployment and management of event scripts, system administrators can automatically deploy them from Enterprise Server to InDesign, InCopy or InDesign Server (either to each application separately or to a combination of these applications).

In short, it works as follows:

  1. The scripts that need to be deployed are placed on Enterprise Server in a Server plug-in.
  2. An Access Right is enabled for those user groups to which the scripts should be deployed.
  3. The user logs in and the scripts are automatically installed, updated, or removed on the local system.

Requirements

Making use of this functionality requires the following to be installed:

  • Enterprise Server 9.5.1 or higher
  • Smart Connection for CC 2014 (10.0.1 or higher)

Default installation

A default plug-in and Access Right are shipped with Enterprise Server; both named "Enterprise Scripts". A set of dummy event scripts are provided with the plug-in which can be modified or replaced as needed.

Note: The Access Right is disabled by default so no scripts will be unknowingly deployed.

When different deployments are needed (such as deploying different sets of scripts to different user groups), multiple instances of the plug-in can be installed and configured.

Creating the scripts

The scripts that can be deployed should all be event scripts: scripts that are triggered when an event takes place. Such scripts are invisible to the end user and can be used to run background tasks.

For more information about event scripts for Smart Connection, see the Smart Connection Scripting and Events Guide.

Note: When creating a compressed file on Mac OS X, additional files and folders are automatically included such as a '_MACOSX' folder, and/or a .DS_Store file. For tips about how to resolve this, see Google Search.

Configuring the default plug-in

In the following steps, the default plug-in is used. With this scenario you will:

  • Deploy one file per client
  • Have one Access Right to define to which user groups the scripts should be deployed

Note: You can create a single file to deploy to all 3 clients or create multiple files to deploy to separate clients.

Examples:

  • File A is deployed to InDesign only, File B to InCopy only and File C to InDesign Server only
  • File A is deployed to InDesign and InCopy while File C is deployed to InDesign Server only
  • Only one file is deployed to InDesign, not to the other clients

1. Placing the scripts in the plug-in

Step 1. Create one or more zipped files containing the scripts that need to be deployed and place them in the SubApplication folder of the Server plug-in:

<Enterprise Server path>/Enterprise/server/plugins/EnterpriseScripts/SubApplication

Tip: As an alternative method, place the ZIP file in a central location such as the file system. The advantage of a central location is that the ZIP file is not touched when upgrading Enterprise Server.

The default server plug-in contains code to provide the ZIP file from the _SYSTEM_ folder in the file store to the clients that request the Enterprise Scripts. The code is commented out by default, but it can be activated easily.

2. Defining to which clients the scripts should be deployed

Step 2. From the EnterpriseScripts folder, open the following file:

Enterprise_Scripts_SysGetSubApplications.class.php

Step 3. Locate the logic that defines which zipped file each client should receive and change it to your needs by pointing each path to the file that needs to be deployed:

if( $req-&gt;ClientAppName == 'InDesign' ) { 
$subApp-&gt;PackageUrl = SERVERURL_ROOT.INETROOT.'/server/plugins/EnterpriseScripts/SubApplication/IDScripts.zip'; 
} 
else if( $req-&gt;ClientAppName == 'InCopy' ) { 
$subApp-&gt;PackageUrl = SERVERURL_ROOT.INETROOT.'/server/plugins/EnterpriseScripts/SubApplication/ICScripts.zip'; 
} 
else { 
$subApp-&gt;PackageUrl = SERVERURL_ROOT.INETROOT.'/server/plugins/EnterpriseScripts/SubApplication/EnterpriseScripts.zip'; 
}

3. Verifying that the plug-in is active

Step 4. In Enterprise Server, access the Server Plug-in Maintenance page.

Step 5. Locate the plug-in named Enterprise Scripts and verify that the icon in front of the installed plug-in is green. If it is not, click the icon to enable the plug-in.

4. Testing the working of the plug-in

Step 6. Access the Health Check page.

Step 7. Clear all tests, select only the test Enterprise Scripts and run the test. The result should display as OK.

5. Controlling to which users the script should be deployed

Step 8. Use the Access Right named Enterprise Scripts in an Access Profile to control to which user group the scripts should be deployed.

Do this by updating and existing Access Profile or creating a new one.

Note: The 'Enterprise Scripts' option is listed under 'Applications'.

Configuring additional plug-ins

In the following steps, a copy of an existing plug-in is made. Each created plug-in will have a dedicated Access Right to define to which user groups the scripts should be deployed. Other than that, the working is identical to that of using the default plug-in.

1. Copying an existing plug-in

Step 1. Copy an existing plug-in, place it in the Enterprise/config folder and rename it:

<Enterprise Server path>/Enterprise/config/plugins/<new plug-in name>

Example: Copy the default EnterpriseScripts plug-in from the Enterprise/server folder:

<Enterprise Server path>/Enterprise/server/plugins/EnterpriseScripts

Note: Use a descriptive name and do not use spaces or special characters.

2. Renaming plug-in files

Step 2. Open the plug-in folder and re-name the following files by replacing the name of the old plug-in with that of the new plug-in:

Plug-in files to be renamed

Old name New name
EnterpriseScripts_SysGetSubApplications.class.php <new plug-in name>_SysGetSubApplications.class.php
/testsuite/HealthCheck2/EnterpriseScripts_TestCase.php /testsuite/HealthCheck2/<new plug-in name>_TestCase.php

Example: Here the files are renamed using the plug-in name "LayoutScripts"

  • LayoutScripts_SysGetSubApplications.class.php
  • /testsuite/HealthCheck2/LayoutScripts_TestCase.php

3. Renaming plug-in references in plug-in files

Step 3. Open the file <plug-in name>_SysGetSubApplications.class.php file and replace all references to the old plug-in name with that of the new plug-in name.

Step 4. Open the file <plug-in name>_TestCase.php file and replace all references to the old plug-in name with that of the new plug-in name.

Step 5. Open the file PluginInfo.php file and replace all references to the old plug-in name with that of the new plug-in name.

4. Configuring the plug-in

Step 6. To install the scripts, target the client applications, assign user groups and test the plug-in, follow the steps for Configuring the default plug-in.

Note: Replace the references to 'EnterpriseScripts' and 'Enterprise Scripts' with the name that you have given the new plug-in.

Client-side functionality

The deployment of scripts works as follows in InDesign, InDesign Server and InCopy:

When the user logs in:

  1. A validation is performed to see if scripts are available for the client application and if the user is allowed to use them.

Note: The user is allowed access to the scripts if the user is in any user group that is allowed access to the Enterprise Scripts for any Brand/Status/Category combination.

  1. When the validation is passed, one of the following occurs:
    • Any existing scripts that were stored when logging in to a different Enterprise Server are removed
    • Any scripts that are not yet available are downloaded
    • Any scripts that are already available are updated
    • Any locally installed event scripts that have the same name as the installed server scripts are overruled

When the user logs out:

  • Any installed scripts are not removed so that they are available when working in offline mode.

Location where the deployed scripts are installed

  • On Mac OS:
  • /Users/<user_name>/Library/Preferences/Adobe InDesign/Version <version_number>/<localId>/Scripts/EnterpriseScripts
  • On Windows:
  • c:\Users\<user_name>\AppData\Roaming\Adobe\<app_name>\Version <version_number>\<localId>\Scripts\EnterpriseScripts
Was this article helpful?
0 out of 0 found this helpful / Created: / Updated:
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.