MXwendler Javascript Interface Description Version 2.3



Similar documents
Using the VMRC Plug-In: Startup, Invoking Methods, and Shutdown on page 4

Using WINK to create custom animated tutorials

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

AP Computer Science Java Mr. Clausen Program 9A, 9B

Understanding Task Scheduler FIGURE Task Scheduler. The error reporting screen.

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

Sizmek Formats. Swell. Build Guide

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

Flash MX Image Animation

Using Text & Graphics with Softron s OnTheAir CG and OnTheAir Video

DiskPulse DISK CHANGE MONITOR

Game Programming with DXFramework

Installing and Sending with DocuSign for NetSuite v2.2

Symbol Tables. Introduction

Portals and Hosted Files

C++ INTERVIEW QUESTIONS

J a v a Quiz (Unit 3, Test 0 Practice)

ESPResSo Summer School 2012

LAB THREE STATIC ROUTING

C# and Other Languages

FLIP PDF FOR MAC. Create your flipping book from PDF files on Mac

Programming Languages CIS 443

VoIP Probe 3.4. Functions, Parameters & Metrics for integration with HP Business Availability Center via HP Business Process Monitor

Inteset Secure Lockdown ver. 2.0

Unit Testing & JUnit

Web Applications Testing

Sizmek Formats. Collage. Build Guide

Lecture 2 Mathcad Basics

LAMBDA CONSULTING GROUP Legendary Academy of Management & Business Development Advisories

Desktop, Web and Mobile Testing Tutorials

CS170 Lab 11 Abstract Data Types & Objects

Bome's Midi Translator

Scripting in Unity3D (vers. 4.2)

Performance Analysis and Visualization of SystemC Models. Adam Donlin and Thomas Lenart Xilinx Research

SCD Server. SCD Server Pro

Introduction to Java

Introduction to scripting with Unity

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

Programmierpraktikum

Chulalongkorn University International School of Engineering Department of Computer Engineering Computer Programming Lab.

U-HID Pac-LED64 PacDrive U-HID LEDs

Classes and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following:

OVERVIEW Playbacks: Shortcuts: Memories: Data Entry Wheels: Touchpad: Master and Blackout:

Creative Cloud for Web Design

English. Asema.com Portlets Programmers' Manual

Auto Clicker Tutorial

Qt Features for Hybrid Web/Native Application Development

MASTERTAG DEVELOPER GUIDE

5 Arrays and Pointers

WebSphere Business Monitor V7.0 Script adapter lab

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

You are to simulate the process by making a record of the balls chosen, in the sequence in which they are chosen. Typical output for a run would be:

Dashboard Skin Tutorial. For ETS2 HTML5 Mobile Dashboard v3.0.2

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Visual Basic Programming. An Introduction

State of Michigan Data Exchange Gateway. Web-Interface Users Guide

Figure 3.5: Exporting SWF Files

Advanced Slider Documentation

Facebook Twitter YouTube Google Plus Website

R&S AFQ100A, R&S AFQ100B I/Q Modulation Generator Supplement

Terminal 4 Site Manager User Guide. Need help? Call the ITD Lab, x7471

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, Introduction 1. 2 Invoking Shell Scripts 2

Generating Automated Test Scripts for AltioLive using QF Test

Kentico CMS Web Parts

Appendix K Introduction to Microsoft Visual C++ 6.0

AP Computer Science Java Subset

CaptainCasa. CaptainCasa Enterprise Client. CaptainCasa Enterprise Client. Feature Overview

Example. Represent this as XML

What makes a good coder and technology user at Mountfields Lodge School?

Sandy. The Malicious Exploit Analysis. Static Analysis and Dynamic exploit analysis. Garage4Hackers

13-1. This chapter explains how to use different objects.

Network Projector Operation Guide

Continuous Integration Part 2

Load testing with. WAPT Cloud. Quick Start Guide

Using the JNIOR with the GDC Digital Cinema Server. Last Updated November 30, 2012

Object Oriented Software Design

TypeScript for C# developers. Making JavaScript manageable

Project 2: Bejeweled

Kiwi SyslogGen. A Freeware Syslog message generator for Windows. by SolarWinds, Inc.

Talend Component: tjasperreportexec

SnagIt Add-Ins User Guide

Introduction to Triggers using SQL

Arrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays:

Yandex.Widgets Quick start

Software Testing. Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program.

Q&As: Microsoft Excel 2013: Chapter 2

Unit 21 - Creating a Button in Macromedia Flash

WP Popup Magic User Guide

Practice Fusion API Client Installation Guide for Windows

How to Add a Transparent Flash FLV movie to your Web Page Tutorial by R. Berdan Oct

Partitioning under the hood in MySQL 5.5

PYTHON Basics

Using Flow Control with the HEAD Recorder

1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius

«W3Schools Home Next Chapter» JavaScript is THE scripting language of the Web.

Scanner sc = new Scanner(System.in); // scanner for the keyboard. Scanner sc = new Scanner(System.in); // scanner for the keyboard

Transcription:

MXwendler Javascript Interface Description Version 2.3 This document describes the MXWendler (MXW) Javascript Command Interface. You will learn how to control MXwendler through the Javascript interface. We will describe parts of the hierarchical control approach and how to create interactive Javascripts in MXWendler. 05.12, valid for builds > 1900 Contents What is Javascript?...1 Why could i control MXWendler using Javascript?...1 Where do i enter Javascript Scripts?...1 Example script: called once on trigger, repeat for 10 seconds...2 Which interface elements can i control using Javascript?...3 Example Script 1: Print Frame Number, Make Screenshot, Start Clip...4 Example Script 2: Reading/Setting SWF Flash Media Variables...6 Command Reference...7 Static functions...7 Objects...9 What is Javascript? Javascript, also known as ECMA Script is a standardized interpreted programming language. It is mainly used in webbrowsers to control web pages and test user input before sending. Why could i control MXWendler using Javascript? Although there are many ways to control MXWendler with a lot of I/O devices, beginning with the mouse, the keyboard, DMX dongles and MIDI devices, and there is a broad automation layer in MXWendler using events and playlists, some desired behaviour is simply too complex to be offered through a GUI element. Javascript allows you to program any animation and behaviour sequence. Additionally, Javascript allows you to emit values to I/O devices like DMX or MIDI ( please check your version for this functionality ) and set various internal states in media, eg. set variables and exchange text strings in SWF files. MXWendler Javascript Reference 2.3 1/16

Where do i enter Javascript Scripts? Scripts reside always close to the events. Scripts have three entry points: void on_trigger ( triggervalue ) this function will be called once after an event occurred and before drawing the frame triggervalue is the normalized value that the mapped control device emits: keyboard ( press/release ) [1:0] midi 0.. 127 [0.. 1] dmx 0.. 255 [0.. 1] float on_repeat(void) this function will be called the next frame after on_trigger has been called. this function will be called repeatedly as long as the function returns a positive value this enables you to create functions that last for a certain time: if you want to create a javascript fade for eg. 10 seconds, create a variable outside this function, give it a value of eg. 250 in on_trigger decrement it by one in on_repeat and return it void on_always(void) this function will be called once each frame regardless of any inner or outer state. be careful with this function, the only way to turn it off is to remove this script and reload the event map MXWendler Javascript Reference 2.3 2/16

Example script: called once on trigger, repeat for 10 seconds 1. Create an event for the space bar 2. Copy and paste this script into the script area of an event. 3. Close events, confirm changes 4. Open javascript console ( ctrl+shift+j ) 5. Trigger the space bar var a; function on_trigger( triggervalue ) a = 250; print_console("on_trigger called with " + triggervalue); function on_repeat() print_console("on_repeat called with " + a--); return a; MXWendler Javascript Reference 2.3 3/16

Which interface elements can i control using Javascript? You can control any element you can adress using the standard hierarchical MXWendler access pattern. To access MXWendler elements, you access the static object "mxw" - it is an object like the javascript Math object, which is always available. To faciliate debugging, a script-wide function "print_console" is available, too. function on_trigger( triggervalue ) print_console("on_trigger called with " + triggervalue); The object "mxw" offers the following members and properties: function on_trigger(value) print various states print_console("current time " + mxw.millis ); print_console("current frame width " + mxw.width ); print_console("current frame height " + mxw.height ); print_console("current output width " + mxw.outwidth ); print_console("current output height " + mxw.outheight ); print_console("current framecounter " + mxw.framecounter ); read-access to IO devices print_console("current dmx value at channel 413 " + mxw.dmx(413) ); print_console("current midi value device 1 channel 10 " + mxw.midi(1,10) ); print_console("current keyboard value for (shift)+(space) " + mxw.keyboard(1,32) ); make a screenshot print_console("make a screenshot named screen.jpg " + mxw.screenshot("screen.jpg") ); access widgets and control and get/set values print_console("access opacity control of main render output " + mxw.widget("/mxw/render/opacity") ); MXWendler Javascript Reference 2.3 4/16

print_console("main render opacity value is " + mxw.widget("/mxw/render/opacity").getvalue() ); print_console("main render opacity: set 0.5 value"); mxw.widget("/mxw/render/opacity").setvalue(0.5); MXWendler Javascript Reference 2.3 5/16

Example Script 1: Print Frame Number, Make Screenshot, Start Clip This script will: always print the current frame number on trigger, create a screenshot 2 seconds after triggering load the set with number 10 var load_set_at; function on_always() read current frame and print to console print_console("current frame: " + mxw.framecounter ); function on_trigger(value) create screenshot with name like "mxw_20125.jpg" makescreenshot("mxw_" + mxw.millis + ".jpg"); store the triggering point in time, add time distance ( 2000 msec = 2 seconds ) load_set_at = mxw.millis + 2000; function on_repeat() this function will be called each frame after on_trigger as log as it returns a value higher than 0 we calc the time distance and use the result to trigger loading a set ret = load_set_at - mxw.millis; if(ret>0) we are early, return value is positive, we will be called again return ret; else ret is lower 0, more than two seconds since trigger so start action MXWendler Javascript Reference 2.3 6/16

let js resolve widget, then send value as command mxw.widget("/mxw/set").setvalue(10); return 0: we are done return 0; MXWendler Javascript Reference 2.3 7/16

Example Script 2: Reading/Setting SWF Flash Media Variables This script will: check for a certain clip check for its media set a variable read that variable and print it to the console only on_trigger is needed function on_trigger(value) get reference of clip do *not* store this value, it is higly dynamic and may change each frame! w = mxw.widget("/mxw/track/active/layer/active/clip"); always check for existence if(w) get media ref. Do *not* store this value, too. m = w.media(); if(m) the name of the flash variable. you have to set this name in your swf creation tool. var swfvar = "Xsize"; set the value, always passed as string. you can set numeric values here or pass names, titles, etc. m.setvariable(swfvar,value); get the value, always returned as string print_console( "I have set "+ swfvar + " to value " + m.getvariable(swfvar) ); MXWendler Javascript Reference 2.3 8/16

Setting SWF Variables through the Javascript Interface MXWendler Javascript Reference 2.3 9/16

Command Reference Static functions Static functions can be inserted at any place in the script field. They do not rely on any objects. void print_console( "hello world" ) Purpose Arguments Debugging help: print a value to the javascript console. String Return value Example None function on_tigger(value) print_console("on_trigger called with value " + val); void on_trigger ( triggervalue ) Purpose Arguments Return value Example Called by the main application whenever a triggering event happened A float value representing the current value of the triggering event. Keyboards emit either 1 or zero, [1:0], Midi values 0.. 127 are scaled to [0.. 1], DMX values 0.. 255 are scaled to [0.. 1] as well None function on_trigger(val) print_console("on_trigger called with value " + val); float on_repeat(void) Purpose MXWendler Javascript Reference 2.3 10/16

Arguments Called by the main application on each frame a) after on_trigger has been called once and b) as long as the function returns a positive value. With this function you can keep the scipt execution alive after an event happened. None Return value Example Float. If the value is greater than zero, the function will be called on the next frame again function on_repeat() print_console("this will be called once after on_trigger"); return 0; void on_always(void) Purpose Arguments Called by the main application on each frame after on_trigger has been called. This is a convenience function as it is exactly the same as on_repeat() returning a positive value. None Return value Example None. function on_always() print_console(" this will be called on each frame once\ on_trigger() has been called.\ There is no way to stop execution until\ the event is redefined or the application is\ stopped. "); MXWendler Javascript Reference 2.3 11/16

Objects There are certain objects available for MXW javascript scripting. They provide access to application specific functions and values. There is one static object, "mxw" that does not need special initialization and is always available. It is the accessor to state values ( framecounter etc. ) and active objects, like clips and the like. There are two other object types, widget and media. A "widget" object represents a unique widget which is available in the User Interface. A "media" object represents the media which is loaded in a clip. mxw Purpose Functions A static object representing the main application. Does not have to be initialized. will return the dmx value of channel xy mxw.dmx( channel ); will send the dmx value to channel xy mxw.send_dmx( channel, value ); will return the midi value of device x channel y mxw.midi( device,channel ); will send the midi value to device x channel y mxw.send_midi( device,channel,value ); will return the keyboard value of key (char) in state 0/1/2/3 (none/shift/ctrl/shft+ctrl) mxw.keyboard( state, char ); 1. servername, ip "192.168.0.2" 2. portnumber 3. Adresspattern 4. d: dbl, i:int, c:string, b:blob 5... arguments. Up to 15 arguments are allowed each argument must have a type letter in arg 4 mxw.send_osc( "localhost", 7000, "/mxw/reply", "ddicc", "2.0", "223349.335", "11", "hello" "world ); will make a screenshot and save it as screen.jpg. the scrrenshot will have the current render size mxw.screenshot("screen.jpg"); will return a widget object corresponding to the identifying string. This object can be used for further actions and queries mxw.widget("/mxw/render/opacity"); MXWendler Javascript Reference 2.3 12/16

Properties milliseconds since software start mxw.millis current gui frame width mxw.width current gui frame height mxw.height current output frame width mxw.outwidth current output frame height mxw.outheight framenumber since software start mxw.framecounter MXWendler Javascript Reference 2.3 13/16

widget Purpose Functions This javascript object is a proxy to a corresponding object in the aplication gui. It can be used for further action and queries. The object must be initialized using mxw.widget() and should not be stored due to the dynamic nature of the user interface bool widget.isvalid(); Returns true if the widget object has been initialized properly. Note that the corresponding real widget may have been deleted meanwhile, so it is good style to resolve the widget at each access ( resolving is very fast ) Good: Bad: mxw.widget("/mxw/...").isvalid(); w = mxw.widget("/mxw/..."); (.. some frames later ) w.isvalid(); access stored reference float widget.getvalue(); Returns the current value of the widget in a 0.. 1 range. void widget.setvalue(float); Sets the current value of the widget to the specified value. media widget.media(); Returns the current media of the widget for further actions and queries. Only successful for clips and preloads. Properties void widget.animate ( initvalue, incomingvalue, duration, delta, type); None Triggers an animation for the widgets value. This behaves exactly as the triggerevents. Type must be set as an integer, corresponding to the available behaviour types ( pass value, go to and loop etc ) Note that sometimes some values may not be used ( eg. incomingvalue when using 'random' type ) but some dummy values must be passed always. MXWendler Javascript Reference 2.3 14/16

media Purpose Functions This javascript object is a proxy to a corresponding media object in the aplication gui. It can be used for further action and queries. The object must be initialized using mxw.widget("/path/to/clip").media() and should not be stored due to the dynamic nature of the user interface string media.getmedianame(); Returns the full path and filename of the media. string media.getvariable(string "var_name" ); Returns the current value of the specified variable. Only useful for swf media. Properties void widget.setvariable(string "var_name", string "new_val"); None Sets the current value of the specified variable. Only useful for swf media. MXWendler Javascript Reference 2.3 15/16

grabber Purpose Functions This javascript object is a proxy to a corresponding DMX or Artnet grabber object in the keystone area. To get a handle to a grabber object, name the grabber in the keystone setup and get the handle with mxw.grabber( grabbername ) float getgrabsizex(); float getgrabsizey(); Returns the size of the grabber in pixels Properties int[] getdata(); None Returns a data array with the grabbed values. Can be sent as a blob by OSC, see mxw.send_osc for details. MXWendler Javascript Reference 2.3 16/16