InfoChannel 3 Advanced ScalaScript Examples

The following examples show various things that can be done using advanced techniques in ScalaScript. Some of the examples and some may require features or fixes in the latest releases of IC3.

These Scripts are technical examples for illustrative and educational purposes and are provided as-is. You are free to adapt, perfect, and use them in any network. As examples, they may not be 100% bullet-proof in your network. Should you require customized versions of these scripts to meet your needs, please contact your Scala Certified Partner or your Scala Channel Manager.

Table of Contents

Show Day and Date in Custom Language

IC3 is currently English-only, so if you use variables such as !Date and !Weekday, you get an English display. The example script shows a technique for using the SysTime() ScalaScript function to read the numeric value for the month or weekday, and thereby choose a custom text for the label. The example script produces French months and days but can be readily adapted for other languages.

The same technique could be employed if a script needs to use different date formats on-screen at once. (To use different date or time formats on different pages, you can just set the DateFormat or TimeFormat variables to the right value -- see your Timing.sca config file for the current value.)

Click here for the Custom Language Day and Date Example.

Sample Game

Here is an example trivia game where the goal is to get a line of four correct answers in a row. OK, so the questions may be a bit too easy...

Click here for the Lines Game Example.

Analog Clock Example

This example was supplied by Serge Verhoeven of C&W Commercials B.V., and shows an analog clock. Essentially it uses trigonometry functions to compute the shape of the clock hands and then draws them.

Click here for the Analog Clock Example.

Daypart Schedule Example

This example shows a main script daypart.sca that calls one of three subscripts, depending on the time of day ("day part"):

No matter when you run the script, it begins by continuously playing the subscript for the current daypart. When the time rolls over to the next daypart, the current subscript is immediately interrupted and the subscript for the next daypart immediately commences.

If you delete the "Daypart Change Trigger" page from daypart.sca, the script will still begin by continuously playing the subscript for the current daypart, but when the time rolls over to the next daypart, the current subscript is allowed to complete before the next daypart's subscript commences. (This can be appropriate when the subscript is relatively short in duration compared to the length of the daypart.)

The script also shows a one-time page shown first, which could be used for any required one-time setup. Also, there is a page that plays in the case that there is no active daypart. You could make this black, or include logic to turn off the display, or what have you.

The script can easily be generalized for more or different dayparts.

Click here for the Daypart Schedule Example.

PDF Printing

Printing a PDF from an ICPlayer can be achieved as follows:

In Windows, every file extension (such as .PDF) has a default behavior, which usually is to open the viewer or editor for that file type. For a PDF file, this behavior normally opens Acrobat Reader or Acrobat. But you can modify the .PDF file extension to have a default behavior of silent printing. Then, a Scala script can use the Launch command to invoke the file using cmd /c mydocument.pdf and voila, it will print silently.

First, download the PDFPrintType.reg registry definition file that creates the following registry keys, which adds a file type called PDFPrint whose default action is to silently print:

REGEDIT4

[HKEY_CLASSES_ROOT\PDFPrint]
@="PDFPrint"

[HKEY_CLASSES_ROOT\PDFPrint\shell]
@="FilePrintSilentEx"

[HKEY_CLASSES_ROOT\PDFPrint\shell\FilePrintSilentEx]

[HKEY_CLASSES_ROOT\PDFPrint\shell\FilePrintSilentEx\ddeexec]
@="[FilePrintSilentEx(\"%1\")]"

[HKEY_CLASSES_ROOT\PDFPrint\shell\FilePrintSilentEx\ddeexec\Application]
@="acroview"

[HKEY_CLASSES_ROOT\PDFPrint\shell\FilePrintSilentEx\ddeexec\Topic]
@="control"

Now check your registry under HKEY_CLASSES_ROOT\.pdf. The default value will be something like "AcroExch.Document". Note that value down if you may wish to undo the following change and restore the normal PDF behavior! To associate the above PDFPrint behavior to the .PDF extension change the default value of HKEY_CLASSES_ROOT\.pdf to "PDFPrint". You can do that in RegEdit or using this PDFPrintActivate.reg registry definition file.

Now, in Scala script, use the Launch EX to invoke your PDF file. For example:

Launch("cmd /c C:\temp\abc.pdf", Minimized(On));
The program cmd fires off a Windows command prompt. The /c parameter to cmd tells it to perform the specified command then exit. The command we specify is simply the document itself. The .pdf default behavior takes care of the rest.

Hotkey EX

IC3 includes the Hotkey EX that lets you trigger events for hotkeys. A Hotkey() atom in a group is active as long as the group is active, so you can make hotkeys work across pages. Use the same keynames and actions (Goto() or Use()) as are supported for button-hotkeys.

Click here for the Hotkey Example.

Plasma Power On/Off Example

This example shows using the Serial EX to operate the controls of a display device such as a plasma screen. The example controls a Toshiba TLP-B2 projector, but could be altered to control any other serial device for which serial interface documentation can be had.

Click here for the Power On/Off Example.

Disable Escape Key Example

This example shows using EscapeKey script variable to disable the Escape key. More interestingly, it shows how you can still use a Hotkey() command so that Ctrl+F12 (or any key you choose) can briefly re-enable the Escape key.

This prevents accidental use of the Escape key while still maintaining a sequence that a maintainer/administrator can still use to quit playback.

Click here for the Disable Escape Key Example.

World Clock / Variables and Formats Example (Updated 2005-09-22)

These ScalaScript examples show the implementation of a world clock using ScalaScript functions to manipulate strings, perform math, and do formatting, all on live variables.

The zip file contains two examples:

Click here for the World Clock Example.

Crawl Style Changes (Added 2005-09-28)

This script shows how to change the style of text during the middle of a crawl, using the style-change tags such as <outline="On">. Note that each of these tags must be at the beginning of the line within the crawl text stream.

Click here for the Crawl Styles Example.


Scala exclamation mark logo