QLab http get requests

825 views
Skip to first unread message

muybi...@yahoo.com

unread,
Feb 4, 2016, 9:50:10 AM2/4/16
to QLab
Hi,

Apologies if this is asked and answered, but is there a way to do http get requests in QLab?

-Brian

Chris Ashworth

unread,
Feb 4, 2016, 10:01:22 AM2/4/16
to ql...@googlegroups.com
Hi Brian,

Depending on what you’re trying to do, you can probably use a Script cue for this.

Here’s an example script I used on a museum installation to get text from a web page and insert it into a Titles cue:

tell application "System Events"
set content to (do shell script "curl \"http://example.com/path/to/resource\"")
end tell
tell application id "com.figure53.QLab.3" to tell front workspace
set live text of cue "1" to content
end tell

muybi...@yahoo.com

unread,
Feb 4, 2016, 11:41:07 AM2/4/16
to QLab
Thanks for the response. I am trying to send a script to a veralite device (to change the lock codes on a door.) Is there a primer for that type of thing anywhere?

Chris Ashworth

unread,
Feb 4, 2016, 4:45:30 PM2/4/16
to ql...@googlegroups.com
Hi Brian,

Can you be more specific?  Which part of it are you trying to figure out? What do you mean by “send a script” to the lock?

micpool

unread,
Feb 4, 2016, 5:12:41 PM2/4/16
to QLab
So, I assume the  the Veralite is an home automation system which can be controlled by a web browser.

I may be barking up the wrong tree here but your requirement would seem to be similar to controlling a projector with a built in web server by simulating the addresses sent when a button is pressed in a web browser.

If that is the case have a look at this script which controls the shutter in a panasonic projector and see if you can bend it to your requirements. The top bit you would replace with appropriately named variables and the strings that would be sent from the web browser for each function .

The second block is for any log on and password requirements and then in command you specify one of the named variables from the top block

The last bit assembles the complete URL and sends it.

If you can't make it work from this then if you can post an example  URL for a command sent from a browser, someone might be able to work out a way of assembling an identical URL from within QLab.


--------------------------------
set powerOn to "/cgi-bin/power_on.cgi"
set powerOff to "/cgi-bin/power_off.cgi"
set shutterClose to "/cgi-bin/proj_ctl.cgi?key=shutter_on&lang=e&osd=on"
set shutterOpen to "/cgi-bin/proj_ctl.cgi?key=shutter_off&lang=e&osd=on"





set theServer to "192.168.0.21" -- set this to the ip address of the projector
set theUsername to "admin1" -- set this to the username for the projector
set thePassword to "panasonic" --set this to the password for the projector
set theCommand to shutterOpen --set the command required, option are, powerOn, powerOff, shutterClose, shutterOpen





set theProtocol to "http" -- vs https
set theUserPass to theUsername & ":" & thePassword -- your Indigo remote access username/password
set theURL to theProtocol & "://" & theUserPass & "@" & theServer & theCommand
set theFinalURL to "\"" & theURL & "\""

with timeout of 1 second
do shell script "/usr/bin/curl" & " " & "--connect-timeout" & " " & "1" & " " & theFinalURL
end timeout


Mic

Reply all
Reply to author
Forward
0 new messages