HOW TO: Control OnTheAir CG remotely (AppleScript or HTTP)

The article below will explain the possible ways to control OnTheAir CG remotely for third parties, or other users who want to know what kind of integration can be done.

If you want to control OnTheAir CG from OnTheAir Video or OnTheAir Node, this won't really help, and you should rather read the following articles:

 

Controlling OnTheAir CG with AppleScripts

We won't give an extensive course on AppleScripts here, as there is a lot that can be done. We will just give you the basics, so you can create your own.

At the bottom of this article, you will find a few files to download. For AppleScripts you will need to download these 2 files:

  • CG3ProjectRemoteControlExample.cg3 : this is a sample project with a few items. Place it in the following folder: Applications/OnTheAir CG 3/
  • AppleScriptDemo_OTACGServer.scpt : this is a sample AppleScript that will modify the sample project above

Once you have downloaded the 2 files and placed the CG project in the appropriate folder:

  • start OnTheAir CG Server and configure the playback settings so you can see the output of OnTheAir CG Server. If you don't have a video device to test, you can use the same trick that is explained with the direct link here: https://www.youtube.com/watch?v=SseHZ4UsQ3o 
  • Make sure that "AppleScript Remote Control" is enabled in the "OnTheAir CG Server preferences > General":

  • open the AppleScript and run it. 

You will then see the text on screen being modified, and then later on the shapes moving. If you look at the AppleScript itself, you will see some explanations of what is done, but it should be easy to "read".

This is quite a simple AppleScript, and there are many things that can be done. To have the complete dictionary, the easiest is to either drag and drop the OnTheAir CG Server application on the application "Script Editor", OR in the application "Script Editor" select the menu "File > Open Dictionary..."

 

Controlling OnTheAir CG from any browser

For this example, you will need to download the third sample file below: CGServer_ControlPublishedItems_Layout.html

And here is how to use it:

  • start OnTheAir CG Server and configure the playback settings so you can see the output of OnTheAir CG Server. If you don't have a video device to test, you can use the same trick that is explained with the direct link here: https://www.youtube.com/watch?v=SseHZ4UsQ3o 
  • Make sure that "HTTP Remote Control" is enabled in the "OnTheAir CG Server preferences > General":

  • You may also want to check which port number should be used (we would recommend to keep 2001), and define a new password (the default password is 1234). Note that you must quit and restart OnTheAir CG Server to apply those changes.

 

Once it is properly setup, simply double-click on that file on the same computer that runs OnTheAir CG Server. This should open your default browser on a page looking something like this:

 

Note that the look of that page is defined only by the html code of the page, so you can modify it the way you want.

If you have multiple projects opened in OnTheAir CG Server, you will see multiple tabs at the top. when you select a project, you are able to do a few things:

  • click on the Start/Pause/Stop buttons to control the playback of the project
  • If the project holds an item that is "Published", you will see the name of the item displayed here. In the example above, we have the same "TextField" that we used for the AppleScript. You can enter a new value for the text field and click on "Set" to modify it in OnTheAir CG Server.

As with the AppleScrip�ts, this web page is just an example of what can be done. Feel free to open the html page with a code editor and modify it at your will.

 

About the REST API

If you have a look at the code of the html sample page attached here, you will see that we use a REST API to communicate with OnTheAir CG Server. We use a few things here, but there are many other things that can be done. For the complete list of requests that can be done in REST, simply start a OnTheAir CG Server application, then on the same computer enter this url in Safari:

http://127.0.0.1:2001/api.html

The page that will open will show you all the instructions for the REST API protocol.

 

Using the html page from a different computer

In the example above, we have simply used the page on the computer where OnTheAir CG Server runs. If you want to use the html page from a different computer, you will have to modify the html page a little bit, but do not worry, it's easy.

First, check the IP address of the computer that runs OnTheAir CG Server. You can find that in "System Preferences > Network".

Just open the html page with the application "TextEdit" or any other Text Editor. When the document is opened, search for "127.0.0.1", you should find the following lines:

var cgPassword = "1234";
var cgIPAddress = "127.0.0.1";
var cgPortNumber = 2001;

Just modify the IP Address 127.0.0.1 (which is the default local IP address) to the IP Address of the computer that runs OnTheAir CG Server, then save the html page and close the document.

Now if you open the webpage from any other computer this will connect to OnTheAir CG Server. 

Note that you should proceed the same way if you have changed either the Password or the port number in the OnTheAir CG Server preferences.

 

 

 

 

Have more questions? Submit a request

Comments

Powered by Zendesk