Script Manager for Nexio G-Scribe



Similar documents
Nexio Connectus Cluster Set Up with SQL Server Backend

Nexio Connectus with Nexio G-Scribe

Desktop, Web and Mobile Testing Tutorials

Hypercosm. Studio.

NEXIO Insight Client v15.1

Sitecore InDesign Connector 1.1

WIM Image Upgrade Instructions

Scribe Online Integration Services (IS) Tutorial

Creating Custom Crystal Reports Tutorial

IBM Operational Decision Manager Version 8 Release 5. Getting Started with Business Rules

SAS BI Dashboard 4.3. User's Guide. SAS Documentation

ADC Windows 7 Professional

Content Author's Reference and Cookbook

WebFOCUS BI Portal: S.I.M.P.L.E. as can be

Chapter 15: Forms. User Guide. 1 P a g e

NEXIO 7.0 Software Release

INFOPATH FORMS FOR OUTLOOK, SHAREPOINT, OR THE WEB

Event Manager. LANDesk Service Desk

Lightworks v12. Quick Start Guide

K2 Designer for SharePoint Hands-On Exercise - Leave Request process

Chapter 4: Website Basics

WebSphere Business Monitor

InstantAtlas TM Server Data Transfer Tools User Guide

HDAccess Administrators User Manual. Help Desk Authority 9.0

Nexio Insight LDAP Synchronization Service

Nexio G8 SNMP Support

FOR WINDOWS FILE SERVERS

WatchDox for Windows. User Guide. Version 3.9.5

Search help. More on Office.com: images templates

Rational Team Concert. Quick Start Tutorial

Content Author's Reference and Cookbook

WebSpy Vantage Ultimate 2.2 Web Module Administrators Guide

Zoom Plug-ins for Adobe

INTEGRATING MICROSOFT DYNAMICS CRM WITH SIMEGO DS3

Infor ERP BaanIV / Baan 5.0 / LN 6.1. User's Guide for Worktop 2.4

Decision Support AITS University Administration. Web Intelligence Rich Client 4.1 User Guide

Intellect Platform - The Workflow Engine Basic HelpDesk Troubleticket System - A102

Windows SharePoint Services 3.0: Introduction to SharePoint Student Manual

Database Forms and Reports Tutorial

WatchDox for Windows User Guide. Version 3.9.0

BLUECIELO MERIDIAN ASSET MANAGEMENT MODULE 2014

Publishing Geoprocessing Services Tutorial

MS830 / MS833 Barcode Reader v1.0 9-December-2014

Tips and Tricks SAGE ACCPAC INTELLIGENCE

BID2WIN Workshop. Advanced Report Writing

About XML in InDesign

Dashboard Builder TM for Microsoft Access

Working with SQL Server Integration Services

How To Write A Cq5 Authoring Manual On An Ubuntu Cq (Windows) (Windows 5) (Mac) (Apple) (Amd) (Powerbook) (Html) (Web) (Font

Microsoft Visual Studio Integration Guide

Nexio Insight EP Logger Application

Dreamweaver CS6 Basics

Microsoft Access 2010 Part 1: Introduction to Access

Exploiting Key Answers from Your Data Warehouse Using SAS Enterprise Reporter Software

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1

COGNOS 8 Business Intelligence

Qualtrics Survey Tool

StreamServe Persuasion SP5 Ad Hoc Correspondence and Correspondence Reviewer

Dreamweaver and Fireworks MX Integration Brian Hogan

Chapter 20: Workflow

Triggers & Actions 10

Maximizing the Use of Slide Masters to Make Global Changes in PowerPoint

Vodafone Business Product Management Group. Hosted Services Announcer Pro V4.6 User Guide

NETWORK PRINT MONITOR User Guide

Intellect Platform - Tables and Templates Basic Document Management System - A101

Entrust Certificate Services for Adobe CDS

Mail Chimp Basics. Glossary

Bitrix Site Manager 4.1. User Guide

USER GUIDE. Unit 2: Synergy. Chapter 2: Using Schoolwires Synergy

Learn About Analysis, Interactive Reports, and Dashboards

Business Insight Report Authoring Getting Started Guide

Installing and Sending with DocuSign for NetSuite v2.2

TUTORIAL 4 Building a Navigation Bar with Fireworks

Appspace 5.X Reference Guide (Digital Signage) Updated on February 9, 2015

Creating Hyperlinks & Buttons InDesign CS6

Sample- for evaluation purposes only! Advanced Outlook. TeachUcomp, Inc. A Presentation of TeachUcomp Incorporated. Copyright TeachUcomp, Inc.

Creating XML Report Web Services

Appointment Scheduler

Code::Blocks Student Manual

Context-sensitive Help Guide

MadCap Software. SharePoint Guide. Flare 11.1

14.1. bs^ir^qfkd=obcib`qflk= Ñçê=emI=rkfuI=~åÇ=léÉåsjp=eçëíë

Introduction to Microsoft Access 2003

PORTAL ADMINISTRATION

Getting Started Guide. Trimble Accubid Enterprise Software

Taleo Enterprise. Taleo Reporting Getting Started with Business Objects XI3.1 - User Guide

UF Health SharePoint 2010 Introduction to Content Administration

Swinburne University of Technology

ChangeAuditor 6.0. Web Client User Guide

Nintex Workflow 2010 Help Last updated: Friday, 26 November 2010

DESIGN A WEB SITE USING PUBLISHER Before you begin, plan your Web site

Content Manager User Guide Information Technology Web Services

Building A Very Simple Web Site

Module One: Getting Started Opening Outlook Setting Up Outlook for the First Time Understanding the Interface...

Security Explorer 9.5. User Guide

Legal Notes. Regarding Trademarks KYOCERA Document Solutions Inc.

Wellesley College Alumnae Association. Volunteer Instructions for Template

Introduction to Final Cut Pro 7 - Editing Basics

Manual POLICY PATROL SIGNATURES FOR OUTLOOK, GOOGLE APPS & OFFICE 365

UF Health SharePoint 2010 Document Libraries

Transcription:

Script Manager for Nexio G-Scribe 8.0.3 5/22/2014 Edition: A

8.0.3 Publication Information 2014 Imagine Communications. Proprietary and Confidential. Imagine Communications considers this document and its contents to be proprietary and confidential. Except for making a reasonable number of copies for your own internal use, you may not reproduce this publication, or any part thereof, in any form, by any method, for any purpose, or in any language other than English without the written consent of Imagine Communications. All others uses are illegal. This publication is designed to assist in the use of the product as it exists on the date of publication of this manual, and may not reflect the product at the current time or an unknown time in the future. This publication does not in any way warrant description accuracy or guarantee the use for the product to which it refers. Imagine Communications reserves the right, without notice to make such changes in equipment, design, specifications, components, or documentation as progress may warrant to improve the performance of the product. Trademarks Nexio Connectus and Nexio G-Scribe are trademarks or trade names of Imagine Communications or its subsidiaries. Microsoft and Windows are registered trademarks of Microsoft Corporation. All other trademarks and trade names are the property of their respective companies. Contact Information Imagine Communications has office locations around the world. For domestic and international location and contact information, visit our Contact page (http://www.imaginecommunications.com/company/contact-us.aspx). Support Contact Information For domestic and international support contact information see: Support Contacts (http://www.imaginecommunications.com/services/technical-support.aspx) ecustomer Portal (http://support.imaginecommunications.com) Academy Training (http://www.imaginecommunicationsacademy.com) 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 2

Contents Contents Script Manager for G-Scribe Guide... 5 Workflow... 5 Open Script Manager... 5 Script Folders... 5 Script Collections... 6 View Scripts... 6 Create a New Script Collection... 7 Create New Scripts... 7 Edit Scripts... 8 Errors... 8 Compile Scripts... 8 Apply Script Functions... 8 Publish Scripts... 10 Run a Function... 10 Change Preferences... 11 Create New User Script and Plugin Folders... 11 Select a Code Editor... 11... 12 Script Features... 12 Current Script Limitations... 12 Script Writing Basics... 13 Script Folders... 13 Compiled Script Folders... 13 Introduction to Writing Scripts... 13 Script Parameters... 14 Simple Script Example... 15 Script Errors... 16 Compilation Errors... 16 Runtime Errors... 17 Logic Errors... 17 Populate Tags in Layouts... 17 Extract Script Arguments... 18 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 3

Contents Query a Tag Value... 19 Generate New Tag Values... 19 Insert Tag Values... 19 Run the Script... 20 Tag Management... 21 OnChange Scripts... 21 Change the Visibility of Objects... 21 Manipulate a Layout... 22 Editor Overview... 22 Select an Object... 23 Modify Visibility... 23 Run the Script... 25 Format Layouts... 25 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 4

Script Manager for G-Scribe Guide Script Manager for G-Scribe Guide Scripts allow you to write useful enhancements to CG and G-3D layouts in the C# and Visual Basic programming languages, using the RTX Net libraries.the flexible scripting language has been tailored to meet individual operator demands. For example, scripts can automate layout tasks, execute triggers in G-3D, standardize object properties, export layouts, and so on. This section describes how to use the Script Manager utility to control all of your scripts and script collections. For an in-depth discussion of scripts and how to write them, see (on page 12). Workflow Script Manager s general workflow follows these steps. 1. Open Script Manager. 2. View your available scripts. 3. Create new collections for your scripts. 4. Write scripts. 5. Compile scripts. 6. Apply a script to a layout or scene. 7. Run a script. See the following topics for details. Open Script Manager Script Manager is available in Script Manager from the CG module or from the G-3D application. To open Script Manager in CG select Tools > Scripts > Script Manager. To open Script Manager in G-3D select Animation > Script Manager. Script Folders During launch, Script Manager loads the scripts from your system s script folder. By default this folder is set to C:\Documents and Settings\All Users\Application Data\Harris\Scripts. The Script Manager installation adds pre-made and compiled scripts to the CompiledScripts folder. View their source files in the Scripts folder. Use the Script Manager s Preferences window to change the default Scripts folder, or to add new folders for storing user scripts. See Change Preferences (on page 11) for more information. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 5

Script Manager for G-Scribe Guide Script Collections When scripts are accessed from the Scripts folder, each script is added to a script collection named after the subfolder its source code is located in. For example, if you create a subfolder called MyUtilities within the Scripts folder, Script Manager compiles all scripts within the MyUtilities folder into a single MyUtilities script collection. View Scripts The Script Collection list on the left side of the All Scripts tab displays all available script collections on your system. 1. Switch to the All Scripts tab. 2. Use the View drop-down list to choose the type of script collections you want to view. Choose the Scripts option to only view script collections whose source files are available. Choose the Plugins option to only view script collections whose source files are unavailable. These types of script collections can be run but cannot be edited. To view both script and plugin collections, choose the All Collections option. 3. Click on a script collection to see more information about the script files it contains. The following information is displayed for each script and collection. The list of individual script files available within each collection. The date and time that each script was built or updated. The status of each script. Scripts which have been edited since they were last loaded are listed as Out of Date. Scripts containing errors have an Error status. 4. View the Function list on the right side of the window to see the functions in the script collection. The following information is displayed for each function. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 6

Script Manager for G-Scribe Guide The names of the functions located within the selected script collection. The function s description, as specified in the function s System.ComponentModel.Description attribute. The type of layout events for which the functions are designed to run. See Apply Script Functions (on page 8) for more information. Create a New Script Collection Follow these steps to create new script collections within the Script Manager utility. 1. Within the All Scripts tab, click the New Collection button. The New Collection window opens. 2. Enter information about the script collection you want to create. Type a name for your script collection in the Name field. Use the Type drop-down list to choose the language you want to write the scripts in. Use the Working Folder drop-down list to select the folder you want to create the script in. See Change Preferences (on page 11) to learn how to change these folders. 3. Click OK. The script collection is added to the Script Collection list. Create New Scripts Follow these steps to create new scripts within a script collection. 1. In the All Scripts tab, select a script collection from the Script Collection list. 2. Click the New Script button. A blank script is added to the selected script collection. 3. To change the name of the blank script, select it and then click on it. Type a new name for the script. 4. Edit the script, as described in Edit Scripts (on page 8). Note: You can add a CS or VB file to the script folder directly without using Script Manager. To learn how to change your script folders, see Change Preferences (on page 11). 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 7

Script Manager for G-Scribe Guide Edit Scripts To edit a script, select it in the Script Collection list and click the Edit Script button. Your chosen code editor opens, allowing you to edit the script file. For an in-depth discussion of scripts and script writing, see (on page 12). Note: See Change Preferences (on page 11) to learn how to choose a new code editor. Errors If a script contains an error, both the collection name and the script name are highlighted and display an error warning on the All Scripts tab. Double-click the error message to view the line number where the error occurred. You can view all script errors in the Script Errors tab. Build errors display within the Build Errors tab. Compile Scripts When you compile scripts from Script Manager, all the scripts in the collection compile into a single DLL file. The DLL shares the name of the collection folder. For example, if your collection folder is named ExportScripts when you compile, all the scripts in the ExportScripts collection are saved as ExportScripts.dll. Use one of the following methods to compile the scripts. On the All Scripts tab, click the Load Scripts button. Script Manager compiles all of the script collections. On the All Scripts tab, check the Auto Load checkbox. Script Manager compiles all of the script collections when you save a change in the Script Editor. The Script Editor is accessed with the Edit Script button. In the Script Editor, click the Load Scripts button. Every time you compile, all the scripts are saved in a new folder named with the current date/time stamp. A build log is also saved in the folder and reports any scripting errors. Apply Script Functions The Layout Scripts tab allows you to apply script functions to events in the current CG layout or G-3D scene. 1. Within the CG module or the G-3D module, open the layout or scene you want to add script functions to. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 8

Script Manager for G-Scribe Guide 2. In the Script Manager, switch to the Layout Scripts tab. 3. In the Scenes/Layouts list on the left side of the tab, select your open layout or scene. The Events list in the middle of the tab displays all the available events for the selected layout or scene. Script Events Event Type OnChange OnSetup OnTake OnClear OnComplete OnPause OnResume Description The function runs when Script Manager is idling or during the OnSetup phase. This allows the canvas to update when the contents of the layout change. The function runs just before layout data is rendered. This event is designed for tag modifications and last-minute updates to layout appearance. The function runs just before the event is taken to air. This event allows the function to make modifications to the item currently on air, as well as a final chance to change what s going to air after the render has completed. The function runs when the event is taken off air with a clear action. The function runs when a scene reaches its end point. By default, the end point marker is at the end of the main timeline in G-3D. You can modify the position of the end point in G-3D. For 2D animations created in the FX Editor the end point is automatically placed at the end of the animation. The position cannot be modified. The function runs when a scene is paused. The parameters to the OnPause script are the scene, the clock that was paused, and a list of the triggers that can resume that pause. The function runs when a paused scene is resumed. The parameters to the OnResume script are the scene, the clock that was resumed, and the name of the trigger that resumed the clock (if it was resumed by a trigger). 4. The Script list on the right side of the tab displays all of your available script collections and functions. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 9

Script Manager for G-Scribe Guide To view the functions within a script collection, click the triangle beside its name. Hover the mouse over the information icon to view a function s description and its compatible event types. Use System.ComponentModel.DescriptionAttribute in your script to describe each function. Use the Search field to view only functions that contain the entered string. The search is not case sensitive. To view only functions compatible with a certain event, select the event from the View list. 5. Drag the function onto a compatible event in the Event list. The event name appears in bold if the function is compatible with the event. Drop the function to apply it to the event. 6. Use the arrow beside the event name to view the functions applied to the event. 7. To remove a function from an event, click the delete icon on the function line. Note: You must have the Rtx.Scripting.IsScriptFunction attribute in the code before the script appears in the Script list. Publish Scripts When a Scribe layout, a Scribelist playlist, or a G-3D scene is published to Nexio Connectus, any user scripts used by the content are published as Script content projects. The pre-made scripts which come with Script Manager are not published to Connectus. See your Connectus for more information about publishing and downloading content. Note: User scripts are only published if they do not already exist on the Connectus file server. Run a Function Functions can be run in the following ways. Functions that are applied to a specific layout or scene event run automatically when the event occurs. See Apply Script Functions (on page 8) for more information. In the CG module, when you right-click an object in the CG workspace, functions with the Rtx.Scripting.CGObjectFunction attribute in their code appear within the Scripts menu option. This allows you to apply functions to objects quickly while working on a CG layout. In the G-3D module, when you right-click on the tree view in the G-3D workspace, functions with the G3D.Scripting.ObjectFunction(<string>) attribute in their code appear in the menu. The <string> is a menu hierarchy to organize how the functions display in the menu. You can manually run a function within Script Manager by selecting a function in the All Scripts tab and clicking the Run Function button. The selected script function performs the desired task on the current layout or scene. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 10

Script Manager for G-Scribe Guide Change Preferences Choose Tools > Preferences to open the Script Preferences dialog. Use the dialog to create new folders for your script and plugin collections, and to select a different code editor. Create New User Script and Plugin Folders After you create a folder, the folder is available for selection from the drop-down list on the All Scripts tab. 1. To create a new user script or plugin folder, switch to the appropriate tab. The Working Folders tab allows you to create a new folder that saves both the script source file and the DLL when you compile. The Plugin Folders tab allows you to create a new folder that saves the compiled DLL files without the source code. This allows you to release scripts without releasing the source code. 2. Click the Browse button. 3. In the Browse for Folder dialog, select the folder you are adding to Script Manager and click OK. 4. In the Script Preferences, click Add to add the folder to Script Manager. Note: You can delete a folder by clicking the Delete button on the folder line. Select a Code Editor By default, scripts are edited in the Script Editor code editor. If you have Visual Studio installed on your system, you can change the default editor to Visual Studio. 1. In Script Manager, select Tools > Preferences. The Script Preferences dialog opens. 2. Switch to the Code Editor tab. 3. Select the new default editor from the drop-down list. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 11

The RTX.NET 7.0 libraries, when used within scripts, add custom functionality and intelligent playback to Script Manager. This tutorial section explains scripts in detail and provides examples to help you write your own scripts. Script Features Some primary uses of scripting are: In G-3D you can run a script to modify the scene you are editing. For example, a script can replicate the animations on a particular timeline. Scripts can modify the current CG layout. For example, a script can automatically distribute a set of text boxes within a layout based on their widths, ignoring empty boxes. Scripts within CG can be set to run whenever a layout is modified. For example, a script can keep a graphic element locked to the right of a text object. If that text object is moved or if its text content changes, the script automatically repositions the graphic element whenever necessary. During playback, a script could run on the playback layout or scene so it appears correctly when it goes to air, based on tag values provided just before output. For example, based on the size of a text object after a tag is applied to it, the script can adjust the location of other objects in the playback element so they are correctly spaced. Scripts can also be aware of the properties of back-to-back takes of a layout or scene. For example, if the previous take had three elements on air and the upcoming take only has two, a script can start an animation to fly the extra element offscreen. Current Script Limitations The 7.0 scripting framework cannot currently reproduce everything that a standalone RTX NET application is capable of. Because mesh data is preloaded into the GPU before scripts are run, playback scripts cannot create new meshes. Attempting to do so results in the new mesh not being shown. Playback scripts should not directly manipulate clocks or other elements that are already managed by the playback engine. The engine does special things when clocks are paused and unpaused, so manipulating clock playback may result in unexpected behavior. 3D RTX applications commonly swap a scene texture with a custom RTX effect (such as a scroll or a crawl). When done in a script, the texture is not replaced and the scene s default material is applied to the object. Scripts cannot perform the Import Scene or Dispose Scene operations within G-3D. Doing so results in the script terminating. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 12

Script Writing Basics Scripts are written using Microsoft.NET languages. We fully support scripts written in Visual Basic (VB) or Visual C#. F# can also be used but it is not officially supported. Script writers use the.net API to operate on RTX layouts (scribes) or RTX 3D scenes. Script Folders By default, scripts reside in the folder C:\Documents and Settings\All Users\Application Data\Harris\Scripts\. The folder is subdivided into separate folders for each collection of scripts. Script Manager installs a Harris subfolder containing some scripts. Script writers can add their own folders, perhaps organized by show. For example all the news scripts could reside in a NEWS subfolder, all the sports scripts in a SPORTS subfolder, etc. The code in each subfolder is completely independent of the code in the rest of the folders. Compiled Script Folders All files in a subfolder are treated as one build unit (project), so they must all be of the same type (VB or C#). All of the code in the subfolder is built into a single script library (DLL file). Because they are built together, a script file s code can call the code in all other files within the same subfolder. This means that if there is a compilation error in a file, the library cannot be built and none of the scripts in the subfolder can be used. However, this does not prevent the other subfolders from being built. Each time a Script Manager application starts it builds its own set of libraries from the script source code. The built DLLs reside in the folder C:\Documents and Settings\All Users\Application Data\Harris\CompiledScripts\[application name]\ In our example with separate NEWS and SPORTS subfolders, the above folder will contain a HARRIS.DLL file, a NEWS.DLL file, and a SPORTS.DLL file, as well as the debugging symbol files (PDB) for each DLL. Note: Because the DLL files are loaded by the application which corresponds to the [application name] folder, there are no file conflicts if a second application uses scripts at the same time. Introduction to Writing Scripts A function is merely a static entry point into one of the classes in the library. These functions must be marked with the public and static keywords. You must also explicitly mark the function as a script function to register it with the scripting engine. The following example is a template for a file in the SPORTS folder. It contains two script functions. Note: The script examples in this document are written in C#. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 13

namespace Sports public class SportsScripts // various script entry points [Rtx.Scripting.IsScriptFunction] [System.ComponentModel.DescriptionAttribute ("Perform Script 1")] public static void Script1( <parameter> ) [Rtx.Scripting.IsScriptFunction] [System.ComponentModel.DescriptionAttribute ("Perform Script 2")] public static void Script2( <parameter> ) The attributes which appear in the square brackets before each function are: An attribute which makes the function visible to the scripting engine. An attribute which sets the display name that is used by the Script Manager. Each fully-pathed script function names must be unique in each library. In this example, no other function in any of the C# files in the SPORTS subdirectory could have the name Sports.SportsScripts.Script1 or Sports.SportsScripts.Script2. Even if the parameter to the script function is different, the name must still be unique. You can use any of the functionality of the.net framework in your scripts. For example, you can use System.Windows.Forms.MessageBox to display a message box. You can also define helper classes within the source code and have your script instantiate these objects, and your scripts can refer to other objects and functions defined in other files within the library s subfolder. Just remember that you cannot refer to code in the other DLLs. Script Parameters So far we have ignored script function parameters. The parameter type depends on when the script is intended to be run. Script Parameters Parameter Type Code Arguments 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 14

OnSetup OnTake OnClear Rtx.Scripting. OnSetupArguments Rtx.Scripting. OnTakeArguments Rtx.Scripting. OnClearArguments Layout or scene being set up. Previous layout or scene on this channel. Layout or scene about to go on this channel. Channel / Layer the effect is on. Layout or scene being cleared. Channel / Layer the effect was on. OnComplete Rtx.Scripting. OnCompleteArguments Scene that reached its end point. Channel / Layer the effect was run on. OnChange Rtx.Scripting. OnChangeArguments Layout that was visibly changed. Also run when the layout is set up, immediately before the OnSetup script is run. Timeline Rtx.CG3D.Scene The timeline s owning scene. Generic None. Run when the "Run Function" button in the Script Manager is clicked. It is the script s responsibility to ask the scripting engine for the current layout or scene. This is accomplished by accessing the properties Rtx.Scripting.Environment.ActiveLayout or Rtx.Scripting.Environment. ActiveScene. Note: It is recommended you perform tough calculations in OnSetup if possible. Use OnTake if necessary, and use scripts run from the G-3D timeline as a last resort. If you do something computationally expensive while your scene is on air, there is no guarantee that it will be computed in time, so you may see animation artifacts such as popping or jittering. It is very common for the OnTake script and timeline scripts to fire triggers (for example, if the text says "Up Next," fire the "ShowUpNext" trigger, which starts a timeline to reveal the "up next" graphic). This is not computationally expensive and it is encouraged. Simple Script Example The following two functions pop up a message box indicating that the corresponding function is being run. using System; using ComponentModel; using System.Windows.Forms; namespace Demo class Demo1 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 15

[Rtx.Scripting.IsScriptFunction] [Description("Print a message box at setup time")] public static void Demo1_OnSetup(Rtx.Scripting.OnSetupArguments args) MessageBox.Show("In Setup Script"); [Rtx.Scripting.IsScriptFunction] [Description("Print a message box at take time")] public static void Demo1_OnTake(Rtx.Scripting.OnTakeArguments args) MessageBox.Show("In Take Script"); To execute this example, create a simple CG layout in Script Manager, then use Script Manager to assign the Demo1_OnSetup function to the Setup event and the Demo1_OnTake function to the Take event as described in Apply Script Functions (on page 8). When you set up and take the layout, message boxes appear at the set up time and take time. These functions can also be applied to a G-3D scene. Script Errors Writing code is inherently error-prone, and there are several places where mistakes can occur. Compilation Errors If the code in a subfolder fails to build, the compiled DLL file is replaced by a TXT file containing the compilation errors, the source code, and the line number where the error occurred. To use the SPORTS example, if the SPORTS subfolder fails to build a BuildLog_SPORTS.txt file is written to the folder. It will contain information such as: c:\documents and Settings\All Users\Application Data\Harris\Scripts\SPORTS\football.cs (69, 68) : error CS0117:Rtx.GX.TagSelectionActionsGXClass does not contain a definition for SelectAllWithName When you receive a compilation error, check to be sure that the library containing the script was built correctly. Opening the Script Manager should verify this. If you are actively editing scripts while the application is running, be sure to reload the scripts after saving all the files you are editing. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 16

If everything is building correctly, open the layout or scene and make sure that all the events have the correct functions associated with them. After renaming scripts you must update events by dragging the functions back onto them. Runtime Errors Each application creates a log of all scripting events in order to verify that scripts are running correctly. In addition, a code log is created when a script fails due to a code error. The Script Manager has a Script Errors tab for displaying errors which occur while Script Manager is open, but if you need information about all script errors you should access the complete logs through a web browser. 1. Open a web browser on your system. 2. Enter the address http://localhost:8000. The logging server displays in your browser window. 3. Click on the Scripting link which corresponds to G-Scribe. The browser displays the scripting logs that were created each time G-Scribe was run. 4. Select the bottom entry to view the most recent log. You will see information about which scripts were run, when they finished, and any error messages that were logged. Logic Errors Message boxes which print the state of particular variables can be used to provide simple diagnostic information about your scripts. If there is a lot of data to examine then writing these values to a file might be more useful. Using a debugger to trace your code is the best way to troubleshoot your scripts. If you have access to a standard or professional install of Visual Studio, you can attach to the application process (G-Scribe, Automation Interface), open your script s C# or VB source code, and set breakpoints to aid in the debugging process. If you only have access to the free Express version of Visual C# or Visual VB, you cannot attach to a running process. The free tool DbgCLR is available in the.net Framework 2.0 Software Development Kit, and it does provide the ability to attach to a process and set breakpoints in a script s code. Populate Tags in Layouts A common use of scripts is to populate the tags in a Script Manager layout. For example, in a board used to display sports scores, you could display the home and away team names and logos when somebody enters a three-letter code. Typing "BOS" could result in the name "Boston Red Sox" automatically appearing as the team name, and the appropriate Red Sox logo appearing beside it. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 17

The following figure shows how to create the layout. It is made to an exaggerated size to demonstrate the technique. There are three tagged layout objects in the layout. The "Team Logo" and "Team Name" objects are in the visible portion of the workspace while the "Team Code" is offscreen. We want to take the value entered into the Team Code object and use it to insert the appropriate tag values for the other two objects. We will write a script to accomplish this at the layout s setup time. Setup scripts run immediately before the layout renders its tagged data. The script needs to do four things: Get the layout object (the SCRIBE) from the script argument. Query the value of the Team Code tag. Generate a path to the appropriate logo file and generate the appropriate team name. Insert the new values into the Team Logo and Team Name objects. Extract Script Arguments This line declares the setup function and extracts an Rtx.CG.Layout object, which we can use to access to the RTX API and query and manipulate the layout. public static void Demo2_OnSetup(Rtx.Scripting.OnSetupArguments args) Rtx.CG.Layout layout = args.setupobject.layout; Note: When dealing with a 3D scene you would use args.setupobject.scene to get an Rtx.CG3D.Scene object. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 18

Query a Tag Value The Tags property of the layout object holds a dictionary which maps tag names to the tag values that were provided to the SCRIBE (either by G-Scribe or via automation). The following line retrieves the text in the Team Code tag. string code = layout.tags["team Code"].Text; Generate New Tag Values Assume that we store all the assets for the teams in D:\DEMO\SPORTS\MLB\. This folder contains a subfolder for each team, and the subfolders are named with three-letter codes: a BOS subfolder for the assets used by the Boston Red Sox, a TOR subfolder for the Toronto Blue Jays, and so on. Assume that the assets in each subfolder consist of two files: team.tga (the team s logo) and data.txt (a two-line file containing the team s city and name on separate lines). This code generates the correct image to display in the layout s Team Logo object. string image = @"D:\DEMO\SPORTS\MLB\" + code + @"\team.tga"; To get the team names, we could hard code the names for each team: if (code == "BOS") name = "Boston Red Sox"; This would not scale well, as you would need to rebuild your scripts each time a team was changed or added. Instead, for this example, we will read the data.txt file. Deriving the name of the data file is virtually identical to deriving the name of the image file. To read the file we will use the System.IO.StreamReader class provided by the.net framework. string datafile = @"D:\DEMO\SPORTS\MLB" + code + @"\data.txt"; System.IO.StreamReader file = new system.io.streamreader (datafile); string name = file.readline() + " " + file.readline(); file.close(); Insert Tag Values Finally, the script must insert the values we generated in the previous example back into the layout objects. This is similar to querying a tag value. layout.tags["team Logo"].Text = image; layout.tags["team Name"].Text = name; Here is the entire script: using System; 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 19

using System.ComponentModel; namespace Demo class Demo2 [Rtx.Scripting.IsScriptFunction] [Description("Populate tags using a team code")] public static void Demo2_OnSetup(Rtx.Scripting.OnSetupArguments args) Rtx.CG.Layout layout = args.setupobject.layout; // Extract the code string code = layout.tags["team Code"].Text; // Generate the logo tag string image = @"D:\DEMO\SPORTS\MLB\" + code + @"\team.tga"; // Generate the team name from lines one and two of the file string datafile = @"D:\DEMO\SPORTS\MLB\" + code + @"\data.txt"; System.IO.StreamReader file = new System.IO.StreamReader(datafile); string name = file.readline() + " " + file.readline(); file.close(); // Save the new tags layout.tags["team Logo"].Text = image; layout.tags["team Name"].Text = city; Run the Script If we use Script Manager to set the Setup script to run this function, we will see the following output when we set the Team Code to BOS. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 20

Changing the Team Code to TOR displays "Toronto Blue Jays" and the logo for the team. To add additional teams simply create more subfolders with team.tga and data.txt files. The script does not need to change. Tag Management For this script we do not want to give news reporters the ability to edit the Team Name or Team Logo tags. They must only be allowed to enter three-letter codes into the Team Code tag. The Quick Edit module within Script Manager allows you to designate which tags are exposed to news reporters, what order they appear in, and the display name for the tag. Within the Quick Edit section of the Nexio G-Scribe, see the Enable Tag Management section to learn how to manage your tags within the Quick Edit module. OnChange Scripts In the world of automation, reporters need to be able to see a representation of their data. In this script example, if the reporter entered TAR instead of TOR in the Team Code tag, they should receive feedback that they entered an incorrect code. OnChange scripts are run before the preview is rendered through automation. In these instances you may prefer to move the script to OnChange instead of OnSetup. Because OnChange scripts are run at the same time as OnSetup scripts, you get exactly the same result when the SCRIBE goes to air. Change the Visibility of Objects Often there are elements in your layout that should become visible or invisible based on the value of a tag. For instance, you may wish to conditionally brand a board with your company s URL and logo. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 21

This next example uses the 102 HD template provided by the Script Manager install. In addition, add three new tagged objects. A text object with the tag name "URL". A logo object with the tag name "Logo". A text object with the tag name "brand". This object must be located outside the visible part of the layout. The purpose of tagging the URL and logo objects is not to allow reporters to edit them, but rather to allow the script to easily detect the objects and change their visibility. As described in the previous example, use tag management to hide the URL and Logo tags from reporters. The script needs to do the following. 1. Retrieve the value of the brand tag. 2. Select the URL object. 3. Make it visible or invisible, based on the value of the brand tag. 4. Select the Logo object. 5. Make it visible or invisible, based on the value of the brand tag. Because we learned how to retrieve a tagged object s value in the previous example, we will focus on steps two to five. Manipulate a Layout To directly manipulate the individual objects in a layout, you access the GX API with an RTX.CG.Editor object. The editor is given the layout object, and all actions you request the editor to perform are performed upon that layout. Note: You should create the editor with a using statement, then do the work on the layout inside the body of the statement. This ensures that any script errors are properly cleaned by the editor. The following code creates the editor for the layout being set up. Rtx.CG.Layout layout = args.setupobject.layout; using (Rtx.CG.Editor editor = new Rtx.CG.Editor (layout)) // do work on the layout Editor Overview You will want to consult the documentation of the RTX.GX to learn everything you can do with an editor, but a small outline is provided here. Use an editor to issue commands to the layout. To access the command hierarchy, use editor.root. From that point there is an organizational structure of related commands you can issue. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 22

editor.root.actions commands perform actions that create, remove, and select objects in the layout. editor.root.textattributes and editor.root.graphicsattributes commands operate on the currently selected objects. For example, you can reposition the objects or change their appearance. editor.root.textandgraphicsattributes commands also operate on the selected objects, and are for editing attributes which are common to both text and graphic objects. There is no substitute for experience and reading through the RTX.GX documentation to familiarize yourself with everything you can do to a layout. Select an Object Selecting objects is a very common task, so it is worth writing a function that we can reuse in our other scripts. Because making a selection is considered an action, we use operations defined in editor.root.actions. In this case we perform the selection with TagManipulation.SelectionByTag. Because we tagged the object with a name we will perform the SelectAllWithName action. First we set the name of the tag we are going to search using the Name property, and then we fire the action. private static void Select(Rtx.CG.Editor editor, string tagname) editor.root.actions.tagmanipulation.selectionbytag.name = tagname; editor.root.actions.tagmanipulation.selectionbytag.selectallwithname.fire(); Note: It is good practice to check that you can actually fire an action before you fire it. In this case we would first check editor.root.actions. TagManipulation.SelectionByTag.SelectAllWithName.CanFire. In these examples we will dispense with these checks unless they need to be reasonably accounted for. Modify Visibility When an object is selected we can set the state of the object s visibility. A property common to text and graphics objects is Visibility.Visible. Setting it to true or false controls whether the object is rendered. private static void SetVisibility(Rtx.CG.Editor editor,bool visible) editor.root.textandgraphicsattributes.visibility.visible = visible; Note: As in the previous sample of code, using a helper function hides the RTX.GX calls away from the main script code. Here is the entire script. using System; using System.ComponentModel; 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 23

namespace Demo class Demo3 [Rtx.Scripting.IsScriptFunction] [Description("Set tag values based on control tags for sports board")] public static void Demo3_OnSetup(Rtx.Scripting.OnSetupArguments args) Rtx.CG.Layout layout = args.setupobject.layout; string brand = layout.tags["brand"].text; bool visible = brand!= "N"; using (Rtx.CG.Editor editor = new Rtx.CG.Editor(layout)) Select(editor, "URL"); SetVisibility(editor, visible); Select(editor, "Logo"); SetVisibility(editor, visible); private static void Select(Rtx.CG.Editor editor, string tagname) editor.root.actions.tagmanipulation.selectionbytag.name = tagname; editor.root.actions.tagmanipulation.selectionbytag.selectallwithname.fire(); private static void SetVisibility(Rtx.CG.Editor editor, bool visible) editor.root.textandgraphicsattributes.visibility.visible = visible; 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 24

Run the Script If N is entered in the brand object, the image on the left displays. Any other value produces the image on the right. Format Layouts Another common use of scripts is to dynamically reposition layout objects based on the size or number of objects. A simple example is the following layout. It has eight tagged text objects uniformly spaced on the page, perhaps for displaying a bullet and title within each object. If the news story only requires six lines of text, we want the bullets to be spaced further apart to fill more of the screen. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 25

With the knowledge gained from this tutorial and a reading of the RTX.GX documentation, writing a script to format this layout is a useful exercise. The script will have to do the following. 1. Find out how many of the text objects contain text. 2. Calculate how far each text object should be spaced from the others. 3. Position all the non-empty text objects in their new locations. The editor command you will need to use is editor.root.textandgraphicsattributes.placement.position.y. For many of these tasks you will write some simple code to help you. For example, you need to select objects by their tag names before you can find out where they are located or reposition them. Note: With minimal extra coding you could also handle paragraph text objects. 2014 Imagine Communications. Proprietary and Confidential. 5/22/2014 Page 26