-- Use the following variable definitions to automate any of the dialogs. Just give it a value, and comment out the dialog below to disable it. For example, set IPAddress to "192.168.1.251" if you'll always use that value.
set commandName to "" -- Any text will suffice: it's used for a comment in code, as well as the new cue's name
set newCueNumber to "" -- This will be unique each time. If you don't want a number, just comment out the dialog below and leave this empty.
set hexCode to "" -- Space-delimited hex codes.
set IPAddress to "" -- The device's IP address, e.g. 192.168.1.251
set networkPort to "" -- The device's receiving network port e.g. 50000
set protocolChoice to "" -- UDP if you need it, leave it empty for TCP.
set commandName to text returned of (display dialog "Command Name:" default answer "Kramer In 1" with title "Command Name" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")
set newCueNumber to text returned of (display dialog "New Cue Number:" default answer "1001" with title "Cue Number" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")
set hexCode to text returned of (display dialog "Hex Code (ensure a space character between each hex byte):" default answer "01 82 81 81" with title "Hex Code" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")
set IPAddress to text returned of (display dialog "IP Address:" default answer "192.168.1.185" with title "IP Address" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")
set networkPort to text returned of (display dialog "Network Port:" default answer "50000" with title "Network Port" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")
set protocolChoice to button returned of (display dialog "TCP or UDP?" with title "TCP or UDP?" with icon 1 buttons {"Cancel", "TCP", "UDP"} default button "UDP" cancel button "Cancel")
-- Use nc's default TCP, or specify UDP?
set transportProtocol to ""
if protocolChoice is "UDP" then
set transportProtocol to "-u "
end if
-- parse space-delimited list of hex codes to a list called eachHexByte
set oldTIDs to AppleScript's text item delimiters
set newTIDs to {" "}
set AppleScript's text item delimiters to newTIDs
set eachHexByte to every text item of hexCode
set AppleScript's text item delimiters to oldTIDs
-- make hex codes echo-able
set hexCodeString to ""
repeat with eachByte from 1 to (count eachHexByte)
set thisByte to item eachByte of eachHexByte
-- strip hextra code (0x or $ or however the manufacturer spells it out)
set thisByteCount to count (characters of thisByte)
if thisByteCount is greater than 2 then
set thisByte to characters (thisByteCount - 1) thru thisByteCount of thisByte
end if
set hexCodeString to hexCodeString & "\\\\x" & thisByte
end repeat
-- put together the shell script
set shellScript to "echo -ne '" & hexCodeString & "'|nc " & transportProtocol & IPAddress & " " & networkPort & " > /dev/null 2>&1 &"
-- put together the source of the script cue
set scriptSource to "-- " & commandName & return & "try" & return & "do shell script " & "\"" & shellScript & "\"" & return & "end try"
-- make a new script cue using the script source
tell application id "com.figure53.qlab.4" to tell front workspace
make type "Script"
set theScriptCue to (first item of (selected as list))
set script source of theScriptCue to scriptSource
compile theScriptCue
set q name of theScriptCue to commandName
set q number of theScriptCue to newCueNumber
end tell
I've been working with a few QLab users recently on sending hexadecimal codes to networked devices like matrix switchers and projectors, to control things like selecting a matrix input or closing a projector's shutter. QLab's Network cue sends OSC and ASCII over UDP, but it doesn't have support for hex codes or TCP at the moment. So we must turn to the Script cue.
On October 5, 2017 at 10:35:56 AM, Gregg Carville (carville...@gmail.com) wrote:
I tried it with an NEC PX750U projector that I networked to no avail.
echo -n '\02\16\00\00\00\18' | nc -u -w 0 192.168.0.10 7142
--
Contact support anytime: sup...@figure53.com
Follow Figure 53 on Twitter: https://twitter.com/Figure53
User Group Code of Conduct: https://figure53.com/help/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "QLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/523698e3-f2ee-4e28-873b-09deee406c87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<gcscreen.tiff>
--
Contact support anytime: sup...@figure53.com
Follow Figure 53 on Twitter: https://twitter.com/Figure53
User Group Code of Conduct: https://figure53.com/help/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "QLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/CANrzNvyvTezsi7MVNRZUHLdka5%2B_G7ncpQOxDWA56vGEx0ZKZg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/0AC08B3E-32AE-4C60-AD98-EF544C4E91DD%40mac.com.
eclipse:~ rich$ help echo
echo: echo [-neE] [arg ...]
Output the ARGs. If -n is specified, the trailing newline is
suppressed. If the -e option is given, interpretation of the
following backslash-escaped characters is turned on:
\a alert (bell)
\b backspace
\c suppress trailing newline
\E escape character
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\\ backslash
\0nnn the character whose ASCII code is NNN (octal). NNN can be
0 to 3 octal digits
You can explicitly turn off the interpretation of the above characters
with the -E option.
echo 41 | xxd -r -p | nc -u -w 0 127.0.0.1 53535
echo 021600000018 | xxd -r -p | nc -u -w 0 192.168.0.10 7142
do shell script "echo '\\x41'” ––> “A”echo '\x41’ ––> “\x41”do shell script "echo -e '\\x41'" ––> "-e A”echo -e '\x41’ ––> “A”
do shell script "echo '\\x01\\x82\\x81\\x81' | nc -u -w 0 127.0.0.1 50000"
echo -e '\x02\x16\x00\x00\x00\x18\c' | nc -w 0 192.168.0.10 7142
-- Use the following variable definitions to automate any of the dialogs. Just give it a value, and comment out the dialog below to disable it. For example, set IPAddress to "192.168.1.251" if you'll always use that value.set commandName to "" -- Any text will suffice: it's used for a comment in code, as well as the new cue's nameset newCueNumber to "" -- This will be unique each time. If you don't want a number, just comment out the dialog below and leave this empty.set hexCode to "" -- Space-delimited hex codes.set IPAddress to "" -- The device's IP address, e.g. 192.168.1.251set networkPort to "" -- The device's receiving network port e.g. 50000set protocolChoice to "" -- UDP if you need it, leave it empty for TCP.set commandName to text returned of (display dialog "Command Name:" default answer "Kramer In 1" with title "Command Name" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")set newCueNumber to text returned of (display dialog "New Cue Number:" default answer "1001" with title "Cue Number" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")set hexCode to text returned of (display dialog "Hex Code (ensure a space character between each hex byte):" default answer "01 82 81 81" with title "Hex Code" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")set IPAddress to text returned of (display dialog "IP Address:" default answer "192.168.1.185" with title "IP Address" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")set networkPort to text returned of (display dialog "Network Port:" default answer "50000" with title "Network Port" with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")set protocolChoice to button returned of (display dialog "TCP or UDP?" with title "TCP or UDP?" with icon 1 buttons {"Cancel", "TCP", "UDP"} default button "UDP" cancel button "Cancel")
(* MOD START *)
-- Use nc's default TCP, or specify UDP?
if protocolChoice is "UDP" thenset transportProtocol to "-u "
elseset transportProtocol to ""end if-- make echo string from hex code input ### NO ERROR TRAPPING HERE IF hexCode WRONG FORMAT ###set hexBytes to {"'"}set currentTIDs to AppleScript's text item delimitersset AppleScript's text item delimiters to spacerepeat with eachWord in text items of hexCode -- Space delimitedset end of hexBytes to text -2 thru -1 of eachWord -- Take last 2 characters even if just 2end repeatset AppleScript's text item delimiters to "\\\\x" -- Need \\ in final output for Script Cue, but each \ needs a \ to escape it here, so \\\\!set echoString to (hexBytes as text) & "\\\\c'" -- Need this to prevent LF at end of echoset AppleScript's text item delimiters to currentTIDs
-- put together the shell script
set shellScript to "echo " & echoString & " | nc " & transportProtocol & "-w 0 " & IPAddress & " " & networkPort(* MOD END *)
-- put together the source of the script cueset scriptSource to "-- " & commandName & return & "try" & return & "do shell script " & "\"" & shellScript & "\"" & return & "end try"-- make a new script cue using the script sourcetell application id "com.figure53.qlab.4" to tell front workspacemake type "Script"set theScriptCue to (first item of (selected as list))set script source of theScriptCue to scriptSourcecompile theScriptCueset q name of theScriptCue to commandNameset q number of theScriptCue to newCueNumberend tell
--
Contact support anytime: sup...@figure53.com
Follow Figure 53 on Twitter: https://twitter.com/Figure53
User Group Code of Conduct: https://figure53.com/help/code-of-conduct/
---
You received this message because you are subscribed to a topic in the Google Groups "QLab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/qlab/T_2lb9rPiO8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/C45E37FA-2D43-4032-922E-F2740E779002%40mac.com.
<Screen Shot 2017-10-10 at 23.00.18.pdf>
--
Contact support anytime: sup...@figure53.com
Follow Figure 53 on Twitter: https://twitter.com/Figure53
User Group Code of Conduct: https://figure53.com/help/code-of-conduct/
---
You received this message because you are subscribed to a topic in the Google Groups "QLab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/qlab/T_2lb9rPiO8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/C45E37FA-2D43-4032-922E-F2740E779002%40mac.com.
echo '\\x02\\x16\\x00\\x00\\x00\\x18\\c’ | nc -w 0 10.116.28.141 7142
echo -e '\x02\x16\x00\x00\x00\x18\c’ | nc -w 0 10.116.28.141 7142
--
Contact support anytime: sup...@figure53.com
Follow Figure 53 on Twitter: https://twitter.com/Figure53
User Group Code of Conduct: https://figure53.com/help/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "QLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/f3ce67df-0cce-4370-9324-cde258ab65d1%40googlegroups.com.
<Qlab_11_1_17_Close.jpeg><PS_11_1_17_Close.jpeg>
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/9c638b04-1092-46c5-b69f-e619943f2295%40googlegroups.com.
THANK YOU LUCKYDAVE AND RICH WALSH for THIS CODE!!!!