Generate Subtitles Cue List Automatically from a text file.

1,092 views
Skip to first unread message

micpool

unread,
Jan 7, 2015, 11:00:24 PM1/7/15
to ql...@googlegroups.com
There are obviously many refinements that can be added but…

Here's a first go

open attached  text edit file


open attached  workspace

Press cntrl-S

Watch the magic unfold

Play the cues.

Mic
titles text list.txt
CreateTitles from textedit.cues

micpool

unread,
Jan 7, 2015, 11:16:34 PM1/7/15
to ql...@googlegroups.com
Whoops

It needed a bit of delay to be added

This v2 one should work
CreateTitles from texteditv2.cues
titles text list.txt

Pierre-Luc Brunet

unread,
Jan 7, 2015, 11:37:25 PM1/7/15
to ql...@googlegroups.com
Wow! Mic, you are on fire. This is one more impressive workspace. 

Thank you for sharing.

Chris Ashworth

unread,
Jan 8, 2015, 11:30:04 AM1/8/15
to micpool, ql...@googlegroups.com
That’s really nice.  Couple of typos in the play titles…. :-)

I feel like we need a whole section on the site devoted to Mic Pool Demo Workspaces….

Joshua Langman

unread,
Jan 8, 2015, 11:58:14 AM1/8/15
to ql...@googlegroups.com
Yes! Please.

micpool

unread,
Feb 12, 2015, 11:35:55 AM2/12/15
to ql...@googlegroups.com
New version of this for use with Qlab 3.1.8 which is simpler as it uses the applescript text hook for the titles cue

Mic
titles text list.txt
CreateTitles from texteditv3.cues

Sean Dougall

unread,
Feb 12, 2015, 11:42:28 AM2/12/15
to ql...@googlegroups.com
This is fantastic as always, Mic. If I may offer one critique, though: I believe you misspelled “Much Adougall”.

--
Sean Dougall
se...@figure53.com

pi...@ndenheuvel.com

unread,
Feb 18, 2015, 8:47:20 AM2/18/15
to ql...@googlegroups.com
Fantastic, Mic!

Op donderdag 12 februari 2015 17:35:55 UTC+1 schreef micpool:

Garrett Ohler

unread,
May 26, 2015, 6:47:59 PM5/26/15
to ql...@googlegroups.com
Awesome scripting, Mic. Do you have any idea how to make each title cue two lines?

So instead of:

Line 1

Line 2

Line 3

Line 4

Each getting their own slide, it would be:

Line 1
Line 2

Line 3
Line 4

Any help would be much appreciated!

micpool

unread,
May 26, 2015, 7:49:27 PM5/26/15
to ql...@googlegroups.com
Sure no problem

Replace the script in cue "TITLES" with this one, which takes pairs of lines from the text document and puts them into the text of the titles with ASCII (10) between them:


tell application "TextEdit"
set thetext to the text of the front document
set thecount to the number of paragraphs in thetext
end tell

tell application id "com.figure53.qlab.3" to tell front workspace
repeat with i from 1 to thecount by 2
make type "Titles"
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 thesecondline to paragraph (i + 1) of thetext
set q name of newCue to the title & " " & thesecondline
set the text of newCue to thetitle & (ASCII character (10)) & thesecondline
end repeat
end tell

nizer

unread,
May 26, 2015, 9:20:53 PM5/26/15
to ql...@googlegroups.com
Mic Pool for president!.....oh he's British. Mic Pool for global czar!

Garrett Ohler

unread,
May 27, 2015, 8:47:53 AM5/27/15
to ql...@googlegroups.com
That's great! Thanks Mic! Minor correction though to the line that says set q name of newCue to the title & " " & thesecondline
It should be set q name of newCue to thetitle & " " & thesecondline

I'm posting the full script below for anyone that want's to copy and paste it:

tell application "TextEdit"
set thetext to the text of the front document
set thecount to the number of paragraphs in thetext
end tell

tell application id "com.figure53.qlab.3" to tell front workspace
repeat with i from 1 to thecount by 2
make type "Titles"
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 thesecondline to paragraph (i + 1) of thetext
set q name of newCue to thetitle & " " & thesecondline

t...@timreidvideodesign.com

unread,
Aug 20, 2018, 1:31:24 PM8/20/18
to QLab
Hi,

I'm trying to adapt this script to allow multiple lines of titles to arrive one at a time (as separate cues), then fade out all together (as part of the cue to bring up a new line 1) after a given number of lines e.g. 4

So it'd be:
q - line 1
q - line 2 (line 1 remains)
q - line 3 (lines 1&2 remain)
q - line 4 (lines 1,2&3 remain)
q - fade out lines 1-4 and fade up a new line 1
...and so on...

I'm new to AppleScript so I'm struggling - I think it's a case of adapting where the "fade out cue" happens - adding a loop to count to four (lines of text) then running the "fade out" subroutine, or perhaps four of them, one for each line...

Any advice welcome!

Thanks Mic and everyone for the great script, it's really opening my eyes into how much can be automated in QLab programming...

Best
Tim

micpool

unread,
Aug 21, 2018, 12:37:46 PM8/21/18
to QLab
On Monday, August 20, 2018 at 6:31:24 PM UTC+1, t...@timreidvideodesign.com wrote:
Hi,

I'm trying to adapt this script to allow multiple lines of titles to arrive one at a time (as separate cues), then fade out all together (as part of the cue to bring up a new line 1) after a given number of lines e.g. 4

So it'd be:
q - line 1
q - line 2 (line 1 remains)
q - line 3 (lines 1&2 remain)
q - line 4 (lines 1,2&3 remain)
q - fade out lines 1-4 and fade up a new line 1



This isn't quite so straightforward as text cues are always vertically centred, so you have to pad them with the correct number of lines if you want the same text to appear in the same position.

In your text file you use forward slashes (/) to mark a new slide build cue and use a space in a line where you want a blank (not just a blank line) e.g

Subtitle 1/Subtitle2/Subtitle3/subtitle4
 
Second Title/this is the second title isn’t it
 

The amended script that handles the build and the padding is:

tell application "TextEdit"

set thetext to the text of the front document

set thecount to the number of paragraphs in thetext

end tell


tell application id "com.figure53.QLab.4" to tell front workspace

repeat with i from 1 to thecount

set oldDelims to AppleScript's text item delimiters

set AppleScript's text item delimiters to {"/"}

set theparagraph to ""

set thepad to ""

set thetitle to paragraph i of thetext

set theItemCount to number of text items in thetitle

repeat with i from 1 to theItemCount

make type "Text"

set selectedCues to selected as list

set newCue to last item of (selected as list)

set thecuenumber to q number of newCue

set theparagraph to theparagraph & (text item i of thetitle) & return

set thepad to " "

repeat with linepad from i to theItemCount

set thepad to thepad & return

end repeat

if thetitle is " " then

set q name of newCue to "BLANK"

else

set q name of newCue to thetitle

end if

set the text of newCue to theparagraph & thepad

end repeat

set AppleScript's text item delimiters to oldDelims

end repeat

end tell


There are various tweaks to the cue numbered MAKE and to the template cues for fades. The new workspace with an example text file is attached


Mic




Subtitles Multi Line Slidebuild.zip

micpool

unread,
Aug 21, 2018, 1:10:26 PM8/21/18
to QLab
And if you want to always bring up the next line automatically immediately  after a multiline slidebuild is faded you can add a cue to the import script group

tell application id "com.figure53.QLab.4" to tell front workspace

set thecues to every cue whose q type is "group"

repeat with eachcue in thecues

if the q name of eachcue is "Crossfade to BLANK" then

set the continue mode of eachcue to auto_follow

end if

end repeat

end tell


As in the V6 worlspace attached


Mic

CreateMultiLineTitlesSlidebuilder from texteditv6.qlab4

t...@timreidvideodesign.com

unread,
Aug 23, 2018, 7:25:33 AM8/23/18
to QLab
Mic, thank you! That is amazing.

One thing puzzles me - in the QLab cue list it talks of • (option 8) as a delimiter - but it seems to actually be /   - or am I missing something?

Thank you again, this and your cookbook are such a fantastic thing for Qlab work...

Best wishes
Tim

micpool

unread,
Aug 23, 2018, 8:04:07 AM8/23/18
to QLab
On Thursday, August 23, 2018 at 12:25:33 PM UTC+1, t...@timreidvideodesign.com wrote:

One thing puzzles me - in the QLab cue list it talks of • (option 8) as a delimiter - but it seems to actually be /   - or am I missing something?

 
set AppleScript's text item delimiters to {"/"}



No you are not missing anything, it's just a mistake. Either change the Memo Cue description to say / or  change the script to "•"
/ is probably clearer and allows you to use opt-8 for bullet points for slide builds in conferences, 

Mic

t...@timreidvideodesign.com

unread,
Aug 23, 2018, 8:05:27 AM8/23/18
to QLab
Got it - thanks again.
T

t...@timreidvideodesign.com

unread,
Nov 21, 2018, 11:48:53 AM11/21/18
to QLab
I'm working once again with the "4 lines" version of the script for a new show, and this time there's a request for a lot of other methods to improve the accessibility of the show.

I wondered if there were any way to set a delimiter which would format the text differently for certain lines - for example we'd like to use some different text colours to represent different characters, and Italics for one case.

When formatting the play text into plain text for the script to generate the titles from, it'd be ideal if I could add a symbol to a line and the script would set that tile to the appropriate colour/format.
I'm racking my brain to think if there's a way to do this as it would seem to require more than one cue template for titles, or a way to change the cue template for those titles.

Any way to set up the Qlab file with example text cues and for the script to "copy style" from those at the appropriate lines?

Thanks for any thoughts... I'm fearing this one may need a lot of manual adjustments :)

Best
Tim

t...@timreidvideodesign.com

unread,
Nov 21, 2018, 11:51:36 AM11/21/18
to QLab
Typo: "it'd be ideal if I could add a symbol to a line and the script would set that title to the appropriate colour/format."

Ben Collins

unread,
Jan 18, 2019, 10:03:48 PM1/18/19
to QLab
Hi Mic, 

Thanks so much for all you contribute, you've taught me so much and saved me thousands of hours to date.
This script alone has saved me on a number of occasions.  When I'm next in the UK I'd like to buy you a beer.

I'm currently working on a show with a lot of cues and a difficult build (devised work with 7 camera inputs and 8 mic inputs) in another language so thousands of subtitle cues.  Combining the 2 cue lists would be near on impossible.  

Is there a way to keep the subtitles in a separate cue list (separate to the main cue list that is operating the show) but trigger it with a script/osc message via a hotkey?
As I understand it, because the nature of the Go trigger being at the workspace level, it would somehow need to query a playhead position or advance the position as it triggers a cue, but not interfere with the playhead in the main cue list.  Is this possible? The thought was renaming subtitles with a suffix that allows something to only listen to cues numbered that contain the correct suffix may be the answer.

Is it worth exploring 1 instance of Qlab trigger another?  that way we can assign go buttons via OSCulator with a controller that only speaks to the individual instance, correct?  

Thanks for your time.

Ben

Richard Sillitto

unread,
Jan 19, 2019, 2:35:46 AM1/19/19
to 'Sebastian Frost' via QLab
Hi Sebastian,

You can easily target cues in a second playlist. Just use the “Play” command, and drag the cue from the cue list stack on the right hand side from the alternative cue list.

This is how I do all my programming now for shows with audio and video - I keep all the video in a separate cue list. This way, one can easily handle the interactions of the various video cues there, and then target them from the “main” cue list with all the audio (and show running) cues.

This way, if the video needs to move around relative to the audio, it’s very easy just to move the position of the “play” trigger - without having to worry about how the video transitions and so on are being impacted by the move.

Hope that makes sense/helps.

Richard.

    M: 07931 955149



--
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/a07d4566-3626-4605-8993-686073106d9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

micpool

unread,
Jan 19, 2019, 3:03:35 AM1/19/19
to QLab
I think what Ben, (not quite sure how Seb got dragged into this), was asking about was multiple cue lists, with individual go buttons to trigger them

Each list can have a go hotkey trigger assigned to it in the triggers tab for that cue list.

Screen Shot 2019-01-19 at 07.56.20.png


This Cookbook chapter, has some scripts and OSC for doing other things with multiple cue lists, like separate previous and next buttons for each  list etc.



Mic

Sebastian Frost

unread,
Jan 19, 2019, 6:17:49 AM1/19/19
to ql...@googlegroups.com
No, me neither!

Richard Sillitto

unread,
Jan 19, 2019, 7:07:14 AM1/19/19
to 'Sebastian Frost' via QLab
Sorry - my bad :) Serves me right for quickly bashing out an email having just been woken up by my son bonking my nose…. Should have followed the whole thread.

Hey ho!

R

    M: 07931 955149


--
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.

Ben Collins

unread,
Jan 20, 2019, 9:14:05 PM1/20/19
to ql...@googlegroups.com
Ahhh wow!
I'm not sure how I managed to miss that! 
That's brilliant.
Thanks Mic.

Ben


aroom

unread,
Jun 1, 2019, 11:32:17 AM6/1/19
to QLab
hi Mic,

would it be possible to add a way to insert black/blank slide ? like for example if a line contain _//_ no text will be added to a slide.

personally I find it better depending of the rhythm of the text to be able to go to a black before sending the next subtitle.

another point about the fade script : what do you think about using the trigger option "When starting the action of this cue : fade & stop peers over time _set the time from the script_" instead of generating a fade for the subsequent slide?

going this way one can freely navigate thru all the cues, if for example one of the actor missed some lines, whiteout fearing to have a text slide staying in the back and have to use the panic button to clear it.

thanks

micpool

unread,
Jun 1, 2019, 3:30:02 PM6/1/19
to QLab
On Saturday, June 1, 2019 at 4:32:17 PM UTC+1, aroom wrote:
hi Mic,

would it be possible to add a way to insert black/blank slide ?


No need to add anything. Just put a forward slash on a line to generate a blank slide 
 

another point about the fade script : what do you think about using the trigger option "When starting the action of this cue : fade & stop peers over time _set the time from the script_" instead of generating a fade for the subsequent slide?


There are no trigger actions in QLab 3. In QLab 4 this is an option. However, because text/title cues are rendered on a transparent background, unless you are snapping from one to another you need to be able to fade the preceding cue before fading in the next, otherwise you will have 2 lots of text visible.

Mic




 

Jean-Etienne Bettler

unread,
Jun 1, 2019, 5:43:44 PM6/1/19
to ql...@googlegroups.com


However, because text/title cues are rendered on a transparent background, unless you are snapping from one to another you need to be able to fade the preceding cue before fading in the next, otherwise you will have 2 lots of text visible.

Mic


True.

So what I did is setting the trigger option - fade & stop over time - on the first line of the group. So when you launch a group, the last slide is always faded, independently of if it’s the previous one or any other.

So I can skip a few cues without fearing to have two texts on screen.


I’m I missing something ? Is it a bad option ?

micpool

unread,
Jun 2, 2019, 3:44:11 AM6/2/19
to QLab
That's a good method if you want random access to any subtitle.

In the QLab Cook Book this chapter deals with non linear and randomly accessed cues.


In QLab 3 it shows a method for using a different go trigger, which performs a panic in time and then a fade up.

If you use this method you don't need to generate groups and fades in your cue list.  You can just hijack the space bar, by clearing it in the key map and then set a group cue to trigger on space.

This group cue can then do all the fading of previous cues, and fading in the currently selected cue (which can be any title/text cue)

Because this uses a mix of script and OSC cues, the delays are quite critical if you need to alter the timings of the fades.

Workspaces attached for QLab3 and 4

Screen Shot 2019-06-02 at 08.38.46.png


Mic




CreateMultiLineTitles from texteditv5.zip

micpool

unread,
Jun 2, 2019, 4:03:35 AM6/2/19
to QLab
On Saturday, June 1, 2019 at 10:43:44 PM UTC+1, aroom wrote:


So what I did is setting the trigger option - fade & stop over time - on the first line of the group. So when you launch a group, the last slide is always faded, independently of if it’s the previous one or any other.

So I can skip a few cues without fearing to have two texts on screen.




If you prefer to have the fade ups in group cues and the fade peers in the group trigger action as you describe then the attached workspace allows you to do this. 
It only creates a group with the incoming title and it's  fade in .

You need to  set up the cue template for group cues to Fade  peers over x secs. 

Screen Shot 2019-06-02 at 08.56.50.png


Mic

CreateMultiLineTitles from texteditv6 (Fade Peers).qlab4

Jean-Etienne Bettler

unread,
Jun 2, 2019, 5:58:58 AM6/2/19
to ql...@googlegroups.com
Wow this is amazing! Thanks!

I’ve added this few OSC commands on the Script list to be able to change Font, Style, Size and Surface:

/cue/*/text/format/fontFamilyAndStyle "Arial Narrow” Bold

/cue/*/text/format/fontSize 100

/cue/*/surfaceID {number}



<Screen Shot 2019-06-02 at 08.56.50.png>


Mic

--
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.

For more options, visit https://groups.google.com/d/optout.
<CreateMultiLineTitles from texteditv6 (Fade Peers).qlab4><Screen Shot 2019-06-02 at 08.56.50.png>

Reply all
Reply to author
Forward
0 new messages