Osc-script

Application to stand along side QLab, receive OSC messages, and call script commands in a separate thread

This project is maintained by Drew Schmidt

Welcome to OSC Script for QLab.

This is an application to work alongside QLab. It is written by a QLab evangelist, not by Figure53. It can be used to perform tasks and call scripts that QLab is currently not meant to do (i.e. UDP, telnet, terminal commands), and because it's a separate application, heavier processes will not cause QLab to hang (For example, a tTelnet command to shutter a projector will not cause dropped frames in a video running in QLab).

Go ahead and download the application with an example QLab Workspace here, but before you start, be sure to read instructions on setup as well as the list of possible commands and protocalls. Feeling adventurous? Feel free to download and alter the source code!

Warning: It's possible to create potentially dangerous code. Code carefully. Code responsibly.

Setup.

OSC Script listens for OSC commands on port 54000. Be sure to start by setting up your OSC patch in QLab with the appropriate IP Address and Port 54000. Use "localhost" if you're running this on the same computer as QLab.



Once you've setup your patch, create OSC cues with a "Custom Message" rather than a "QLab Message".

OSC Commands.

Quit Application

This application has no menu bar, so to quit or exit the application, you'll need to send an OSC command


/quit
/exit
Send Apple Script Code

This command will run a chunk of Apple Script code. It's meant to be used with short snippets. If you need to use quotations, use an apostrophe. If you need nested quotations, consider using the Call Apple Script by Path command


/runScript/code {String}

Example:
/runScript/code "tell app 'finder' to sleep"
Call Apple Script by Path

Using this command, you can call a pre-written Apple Script that is saved as a *.scpt file. Never created a script? Use Applications/Utilities/AppleScriptEditor. Write what you need. Test it in the editor. Then save your code as a "Script" file.


/runScript/path {String}

Example:
/runScript/path "~/Desktop/Go To Sleep.scpt"
Run a Command in Terminal

Sometimes you'll need to run a command from the OSx Terminal window. You could always use AppleScript to do this, or you can simply run one from here. Be sure to test your commands out in Terminal before creating an OSC message.


/runScript/terminal {String}

Example:
/runScript/terminal "pmset sleepnow"
Send a UDP String

The application will allow you to send text over a UDP connection. I like to use this to send commands to my ETC Gio lightboard. But there are plenty of options.


/runScript/UDP {String:IPAddress} {Integer:Port} {String:Command}

Example:
/runScript/UDP "10.3.11.243" 7000 "$Channel 404 at 50#"
Send a Telnet Command

Use the following commands to craft and send commands via Telnet. There are multiple commands to help you adjust settings for your specific system.

Username: Telnet Username [Default is nothing. Don't use this if you don't need this]

Password: Telnet Password [Default is nothing. Don't use this if you don't need this]

Timeout: The Number of seconds before the application will quit trying to open a connection. [Default is 30 seconds]

Delay: The number of seconds between creating a connection and sending a command. Increase this value for a slow network [Default is 0.1 seconds]

Port: The port overwhich Telnet commands are sent [Default is 23]


/runScript/terminal {String:IPAddress} {String:Command}
/runScript/telnet/username {String}
/runScript/telnet/password {String}
/runScript/telnet/timeout {Decimal}
/runScript/telnet/delay {Decimal}
/runScript/telnet/port {Integer}

Example:
/runScript/telnet "10.3.12.66" "~0071 1"
/runScript/telnet/username "Administrator"
/runScript/telnet/password "1234"
/runScript/telnet/timeout 15
/runScript/telnet/delay 0.5
/runScript/telnet/port 23

Troubleshooting.

OSC Script will send info and error messages back to QLab over OSC. To view these messages you'll first need to enable logging in QLab by going QLab/Preferences. Then selecting "2 - Some debug logging"



Once this is selected, you can view the console log by opening Applications/Utilities/Console. It might help you to search for "UDP" and filter only the commands from OSC Script.

Customize.

Feel free to visit the GitHub page or download the Zip and alter any code you want. Everything is written in python which can be edited via IDLE. After downloading the code you'll need to install one python library.

Open Applications/Utilities/Terminal and copy-paste each command one by one.

Install PyOSC

$ curl -O https://gitorious.org/pyosc/devel/archive/633c0112318a3519314aa798a552a092566c73c1.tar.gz
$ cd ~/Downloads/
$ open "633c0112318a3519314aa798a552a092566c73c1.tar.gz"
$ cd pyosc-devel
$ sudo python setup.py install
 * You'll need to enter your password here *
Edit Code

$ sudo IDLE
 * You'll need to enter your password here *
From here, you can open the python script (OSC Script.py), alter, edit and run the code.

Support or Contact.

Remember, this code is provided for you as is. Occasionally we can add elements, features, or try to fix bugs. Please feel free to use the app, use the code, and adapt it for yourself and your own needs.