[QLab] Script, Terminal and PJLink

7,466 views
Skip to first unread message

Robert Larsen

unread,
Apr 3, 2011, 4:39:08 PM4/3/11
to ql...@lists.figure53.com
Hey Goup,

I'm about to do a little journey into the world of PJLink, does anyone
have any experience to offer? I suppose it should be as simple as a
QLab script cue to Terminal including a string that conforms to the
PJLink protocol.

So many useful opportunities here with a fairly generic standard, I'd
be suprised if no one has tried this yet, yeah?

Love your thoughts.
Rob Larsen.
________________________________________________________
WHEN REPLYING, PLEASE QUOTE ONLY WHAT YOU NEED. Thanks!
Change your preferences or unsubscribe here:
http://lists.figure53.com/listinfo.cgi/qlab-figure53.com
Follow Figure 53 on Twitter here: http://twitter.com/Figure53

Stew Ives

unread,
Apr 19, 2012, 5:39:31 PM4/19/12
to ql...@googlegroups.com, Discussion and support for QLab users.
Rob,
   This had been bugging me the past couple of days and contacted lucky dave this morning actually about controlling panasonic projectors over the web interface as I was about to throw in the towel trying to get this to work. I've had success controlling projectors in Isadora via PJLINK using the TCP Send Actor but hadn't tried using QLab to communicate via PJLINK by means of AppleScript. Essentially in the script below I am launching a telnet session in Terminal on port 4352 (PJLINK standard port), sending the command, and then closing the terminal window. Note: I have removed the password on my Panasonic DX800 which strips the PJLINK authentication. What is exciting about this to me is that it should work on any projector that uses the PJLINK standard. 

tell application "Terminal" to activate
tell application "Terminal"
do script "telnet 192.168.0.8 4352" in window 1
do script "%1AVMT 30" in window 1
do script "EXIT" in window 1
delay 0.2
tell application "Terminal" to quit
end tell

192.168.0.8 is my Projector IP Address
"%1AVMT 30" is Open Shutter (PJLINK Standard) which could be replaced with 
"%1AVMT 31" - Close Shutter
"%1POWR 1" - Power On
"%1POWR 0" - Power Off
"%1INPT 11" - Switch to RGB Input (on Pana DX800 atleast, this will some variation depending on the projector model. 
"%1INPT 12" - RGB 2 ; "%1INPT 21" - Video 1 ; "%1INPT 21" - S-Video 1 ; "%1INPT 31" - DVI

Hope this helps!
Stew Ives

Robert Larsen

unread,
Apr 19, 2012, 11:28:47 PM4/19/12
to QLab
Thanks Stew!

I got sidetracked before implementing this, though I am pleased you
successfully experimented. Cool.

+1 for native Telnet cue!

rob.

Dave "luckydave" Memory

unread,
Apr 19, 2012, 11:31:18 PM4/19/12
to ql...@googlegroups.com
I'm with Rob on this one. I've been hoping someone would write this script for a long time. (Mostly because I just can't be bothered to learn PJLINK.) Thanks!


-- 
 

Dave Thwaites

unread,
Apr 22, 2012, 3:34:51 PM4/22/12
to ql...@googlegroups.com
Hi Stew (and others!)

I've also been looking at PJLink over the last few weeks (great mind think alike, eh?!), and have wound up with a very similar script to you, but with a few differences / additions that might be useful to you, or others looking to do this or other telnet-based things.  I'm picking up AppleScript as I go along, so this is a bit of a work in progress!

My script currently looks something like this:

set EscapeChr to ASCII character 29
tell application "Terminal"
if (count of the windows) is less than 1 then
tell window 1 to do script ""
delay 1.0E-5
set hideMe to true
end if

do script "telnet -NK4c 192.168.1.120 4352" in window 1
delay 1.0E-5
do script "%1AVMT 31" in window 1
delay 0.4
do script "" in window 1
do script EscapeChr & "quit" in window 1
if hideMe then tell window 1 to set miniaturized to true
end tell

The main differences between our versions are:
  • I want to leave Terminal running after I've run the script.  Mainly this is so that I can look back at what's happened if things go wrong, but I guess it might speed things up a little bit (maybe..?) to not have to wait for Terminal to load before calling telnet.
  • The If ... End If section at the top (and the final If statement at the end) tries to deal as neatly as possible with the various "Terminal running / not running" scenarios - I think it should work if Terminal is completely closed, or is running but without any windows open, or has one (or more) windows open (miniaturized or not).  It doesn't cope if the front-most Terminal window is busy doing something else, however...
  • I've also avoided telling Terminal to 'activate', which should mean that the terminal window never actually gets the user input focus - it stays with the QLab window.  Therefore if the operator presses any keys while the script is running they get processed by QLab as expected, not Terminal.  One other beneficial side effect of this is that if a new Terminal window is opened it should appear behind the QLab window, therefore not obscuring the current cue list.
  • The various flags after the telnet command are an attempt to make it run in a consistent (and very basic) manner.  In particular I've had occasional issues with telnet pausing for approx 30s before actually connecting to the projector - I think this was due to it trying to look up the given IP address, and the -N flag prevents this from happening.
  • The various delay statements in my script (and the line do script "" in window 1 near the end) are just an attempt to make the Teminal window neat and legible (trying to make sure that the various commands and responses are visible and displayed in the right order!) - I believe it will run happily without any of them if absolute speed is an issue.
  • So far as I can tell, there isn't a 'quit' or 'exit' command in the PJLink specification - instead you just disconnect when done, or otherwise the link should time out after 30 seconds and the projector should disconnect you.  The line do script EscapeChr & "quit" in window 1 near the end gives a quit instruction to the telnet client, and so disconnects from the projector (and it also frees up the Terminal window for the next command).
  • The two lines that involve the hideMe variable (one near the top, one right at the end) mean that if a new Terminal window is opened (because Terminal is running, but has no windows open at all) then it will be miniaturized to hide it from view and keep the desktop display tidy.  (If the operator then restores the window to check what's going on, it will stay restored the next time the script is called.)  The miniaturization happens right at the end of the script because the genie miniaturization effect seems to take half a second or so (the scale effect is faster!), and the script waits for this to happen before moving on - therefore I thought it better to do this after we've done our telnet/PJLink command, so as not to delay that at all.  (If anyone can suggest a way to open a new Terminal window already miniaturized that would probably be preferable!)

The results in the Terminal window should look something like this:
Last login: Sun Apr 22 14:41:50 on ttys000
Pegasus-Mac-Pro:~ pegasus$ telnet -NK4c 192.168.1.120 4352
Trying 192.168.1.120...
Connected to 192.168.1.120.
Escape character is '^]'.
%1AVMT 30
%1AVMT=OK
^]quit

telnet> Connection closed.
Pegasus-Mac-Pro:~ pegasus$ telnet -NK4c 192.168.1.120 4352
Trying 192.168.1.120...
Connected to 192.168.1.120.
Escape character is '^]'.
%1AVMT 31
%1AVMT=OK
^]quit

telnet> Connection closed.
Pegasus-Mac-Pro:~ pegasus$ 

(The %1AVMT=OK is an acknowledgement from the projector that it has done the command successfully (AV Mute in this case) - the delay 0.4 statement in the script is only there to wait for this response to come back)

We've got a Panasonic PT-DZ6700 projector, and it seems to understand the same set of instructions that Stew posted.  PJLink is a pretty simple protocol, so I would expect projectors from other manufactures that support it to also use much the same set of instructions - your instruction manual ought to have details of what is supported and what isn't.

If you see the response PJLINK ERRA from the projector, this means that it is set up for a secure connection with password authentication.  I can't currently see any way to handle an authenticated connection with AppleScript and Terminal/telnet, so you'll have to consult your projector manual to find out how to disable PJLink authentication - as Stew says, on my Panasonic the way to do this was to remove the administrator password from the web interface.

If you want to manually test to see if you've got your projector set up and connected correctly, open a Terminal window and type in: telnet -NK4c 192.168.1.120 4352  (where 192.168.1.120 should be changed to the IP address for your projector).  You should see a few lines from the telnet client, followed by PJLINK 0 - if you see PJLINK 1 xxxxxxxx (where xxxxxxxx is 8 hexadecimal digits) then PJLink authentication is turned on.  If you see neither, or telnet fails to connect, then something isn't set up right!  (I had to enable PJLink Control through the projector's network menu).


Hmmm...  That seems to have become quite a long email!..  Hopefully it'll be interesting and/or useful to someone!  I'm also experimenting with using a very similar script to talk to our paging system (an Audia system from Biamp) which has a telnet interface and command set - I should be able to use it to mute/un-mute the backstage show relay mic, for example, or to automatically switch the foyer/cafe background music over to pre-show music coming from the control box.  So therefore, I would have thought that any other systems that use telnet (or any other simple text-based IP protocols, such as PJLink) ought to be controllable in a similar way.

Any further thoughts, anyone..?
Cheers,
Dave

Frédéric

unread,
Apr 12, 2013, 11:00:44 AM4/12/13
to ql...@googlegroups.com, Discussion and support for QLab users.
I close shutters (for example) on panasonics with following script.


set newFile to "new file"

tell application "URL Access Scripting"

open location "http://192.168.0.8/cgi-bin/proj_ctl.cgi?key=shutter_on&lang=e&osd=off"

open location "http://192.168.0.9/cgi-bin/proj_ctl.cgi?key=shutter_on&lang=e&osd=off"

quit

end tell

tell application "Safari"

activate

tell application "System Events"

delay 1

keystroke "w" using (command down)

end tell

tell application "System Events"

delay 1

keystroke "w" using (command down)

end tell

tell application "System Events"

delay 1.5

keystroke "w" using (command down)

end tell

tell application "System Events"

delay 2

keystroke "h" using (command down)

end tell

end tell


This is a case with 2 beamers. First six lines are important, the rest is just to close the safari windows that popped up. It worked well for me. I don't know all that much about scripting. I came this far searching this group and the web. So I don't understand all that much the above scripts. Will it go a lot faster if you do it with PJlink-code in the script??

I also found Jonas Jongejan's little app very promising. But our video Mac Pro is  running snow-leopard for other reasons and the app needs Lion.

So why do we need this pjlink?



Op woensdag 10 april 2013 12:20:54 UTC+2 schreef Georg Kettele het volgende:
Hey Group,


I was trying the script from Dave and somehow with no result.

I tried to send the the commands directly from the terminal - also with 
no result. (maybe problem with the EscapeChr ona german keyboard?)

I was testing DataComet X and it all worked there fine. 

My projectors are all set up for pjlink (it works also perfectly with Projector MIDI Remote)
but I would need it to work with applescript (called by iCal)



Thanks for any advice 

Georg

Emmanuel Pidre

unread,
Oct 2, 2013, 8:21:02 PM10/2/13
to ql...@googlegroups.com, Discussion and support for QLab users.
Hi Guys, I found this thread going around PJlink to control Projector's on/off. I think I am in the same situation as all of you, I am basically developing a visual installation which have to turn on and off automatically over periods. So I found that PJlink is by now the best option. 

But, I got some troubles. 

Stew > 
With your code I get the following error : error "Terminal got an error: Can’t get window 1." number -1728 from window 1

Dave > 
Grate Job, it seems that is exactly what I need but still i have problems to make it work. 
If I run the script exactly how it is here I get the following error : error "The variable hideMe is not defined." number -2753 from "hideMe"

It seems that is not going inside the If statement so I commented it and seems to be working fine. 
When I run the following script, which is a more simple test from dave's code:

tell application "Terminal"

tell window 1 to do script ""

delay 1.0E-5

do script "telnet -NK4c 192.168.100.10 4352" in window 1

delay 1

do script "" in window 1

delay 10

do script "%1AVMT 30" in window 1

do script "" in window 1

end tell




I get the following in the Terminal:

telnet -NK4c 192.168.100.10 4352
Last login: Thu Oct  3 01:13:10 on ttys000
NZNZ:~ NZNZ$ telnet -NK4c 192.168.100.10 4352
Trying 192.168.100.10...
Connected to 192.168.100.10.
Escape character is '^]'.
PJLINK 0
%1AVMT 30

Connection closed by foreign host.
NZNZ:~ NZNZ$ 


So I am not receiving the "%1AVMT=OK" confirming that the command was well executed by the projector. 
Any idea why is this happening ? the projector seems to be perfectly connected by PJlink. Maybe the codes are not 
supported by this projector (Optoma ZW212ST)?

Thanks a lot for all the work ! you are great ! <3

Emmanuel Pidre

unread,
Oct 2, 2013, 8:21:48 PM10/2/13
to ql...@googlegroups.com, Discussion and support for QLab users.
Sessions seems to be closing by the projector ? and I am not receiving the "%1AVMT=OK" confirming that the command was well executed by the projector. 
Any idea why is this happening ? the projector seems to be perfectly connected by PJlink. Maybe the codes are not 
supported by this projector (Optoma ZW212ST)?

Thanks a lot for all the work !
 you are great ! <3








El domingo, 3 de abril de 2011 21:39:08 UTC+1, Rob Larsen escribió:

Ben Pit

unread,
Oct 9, 2013, 11:41:59 AM10/9/13
to ql...@googlegroups.com, Discussion and support for QLab users.
thanks frederic,
finally we can do it this way:

tell application "Terminal"
set currentTab to do script ("telnet 192.168.1.8 3002")
delay 0.1
do script("(shu1)") in currentTab
delay 0.1
set currentTab to do script ("telnet 192.168.1.6 3002")
delay 0.1
do script("(shu1)") in currentTab
delay 0.1

end tell


we didn't try your suggestion but it seems to be special for panasonic, isn't it ?

thanks a lot

Ben

Ben Pit

unread,
Oct 9, 2013, 11:46:51 AM10/9/13
to ql...@googlegroups.com, Discussion and support for QLab users., equisigr...@gmail.com
thank you too Emmanuel !
for christie projector we found this script: 
tell application "Terminal"
set currentTab to do script ("telnet 192.168.1.8 3002")
delay 0.1
do script("(shu1)") in currentTab
delay 0.1
set currentTab to do script ("telnet 192.168.1.6 3002")
delay 0.1
do script("(shu1)") in currentTab
delay 0.1 
end tell

mic

unread,
Oct 9, 2013, 3:38:58 PM10/9/13
to ql...@googlegroups.com, Discussion and support for QLab users.
Hi everybody,

my way of opening shutter on panasonic is using a script cue with the following content:

do shell script "sh curl http://admin1:pana...@192.168.10.100/act.htm?SET=shut_off > /dev/null 2> /dev/null"

and to close it:

do shell script "sh curl http://admin1:pana...@192.168.10.100/act.htm?SET=shut_on > /dev/null 2> /dev/null"

ciao
michele

Thomas David

unread,
Feb 22, 2014, 6:37:20 AM2/22/14
to ql...@googlegroups.com
Dave,

Thank you for your post. You were really helpful to get my telnet setup on my Panasonic because I was having the authorization errors at first. Had one question about your code. You use "1.0E-5" when doing a delay. What does that do exactly? I have always been just using 0.2.
Tom

Reply all
Reply to author
Forward
0 new messages