Skip to content

Instantly share code, notes, and snippets.

@cyphunk
Last active August 27, 2020 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyphunk/4260840b60c35d7362ea7fe3d43ff074 to your computer and use it in GitHub Desktop.
Save cyphunk/4260840b60c35d7362ea7fe3d43ff074 to your computer and use it in GitHub Desktop.
Import subtitle text from Glypheo into QLab and trigger Glypheo from QLab
-- for the Theater show "The History of Korean Western Theater"
-- Assumes Glypheo has two text field tracks.
-- In our case the Left most is Korean subtitles, right most English
-- These will be imported into QLab and be used to name a Group Cue
-- inside the Group Cue a OSC message is created to then trigger Glypheo from QLab
-- another OSC message is added to be sent to Ableton
-- This way Qlab is used to control both the subtitles and Ableton (ableton controls rice cookers and robotics on stage)
--set TitleType to "Titles" -- Qlab v3
set TitleType to "Text" -- Qlab v4
set cueStartNumber to 0
on make_cue(cueNumber, thetitle, thetitleEn)
tell application id "com.figure53.QLab.4" to tell front workspace
make type "Group" -- Cue numbers not altered from QLab defaults
set groupCue to last item of (selected as list)
if q type of groupCue is "Group" then
set mode of groupCue to timeline
set q name of groupCue to thetitle & " :: " & thetitleEn
set the q number of groupCue to cueNumber
-- SETUP OSC cUE for Local host (patch 1)
make type "Network" -- Cue numbers and names not altered from QLab defaults
set oscLocalCue to last item of (selected as list)
set the osc message type of oscLocalCue to custom
set the custom message of oscLocalCue to "/goTo " & cueNumber
set the q number of oscLocalCue to ""
set the patch of oscLocalCue to 1
move cue id (uniqueID of oscLocalCue) of parent of oscLocalCue to end of groupCue
-- SETUP OSC cUE for Remote (patch 2)
make type "Network" -- Cue numbers and names not altered from QLab defaults
set oscRemoteCue to last item of (selected as list)
set the osc message type of oscRemoteCue to custom
set the custom message of oscRemoteCue to "/goTo " & cueNumber
set the q number of oscRemoteCue to ""
set the patch of oscRemoteCue to 2
move cue id (uniqueID of oscRemoteCue) of parent of oscRemoteCue to end of groupCue
--make type "Titles"
--make type TitleType
--set selectedCues to selected as list
--set newCue to last item of (selected as list)
--set thecuenumber to q number of newCue
--set thetitle to paragraph i of thetext
--set q name of newCue to thetitle
--set the text of newCue to thetitle
--move cue id (uniqueID of newCue) of parent of newCue to end of groupCue
collapse groupCue
end if
end tell
end make_cue
display dialog "Instructions
1: Open Glypheo with show file
(Korean should be on left column, English right of that)
3: Create new Qlab project
4: Make sure Qlab project has 2 Network/OSC targets" buttons {"ok", "stop"}
if the button returned of the result is "stop" then
error number -128
return
end if
set importTest to false
tell application "System Events"
tell process "Glypheo"
display dialog "Import all lines or just first 5?" buttons {"first 5", "all", "stop"}
if the button returned of the result is "stop" then
error number -128
return
else if the button returned of the result is "first 5" then
set importTest to true
end if
set cueNumber to cueStartNumber
repeat with r in rows of outline 1 of scroll area 1 of splitter group 1 of window 1
--set end of _txtElements to value of text field 0 of r --end repeat
log value of r
set kr to value of text field 1 of r
set en to value of text field 2 of r
my make_cue(cueNumber, kr, en)
set cueNumber to cueNumber + 1
if importTest is true and cueNumber ≥ 5 then exit repeat
end repeat
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment