Color text cue script

899 views
Skip to first unread message

benvr...@gmail.com

unread,
Oct 10, 2017, 11:20:41 AM10/10/17
to QLab
Hi all,

I can't seem to come up with a script to change the color of the text in a text cue. Any help would be greatly appreciated!

Thank you !

Brent Lord

unread,
Oct 10, 2017, 1:24:22 PM10/10/17
to QLab
Hello!

Below is an example of a basic script that sets the text color of Text cue "1":

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

set theCue to cue "1"

set theFormat to {rgbaColor:{red:0.3, green:1, blue:1, alpha:1}}

set text format of theCue to theFormat

end tell


You can set many different formats in the same cue, so the "text format" and "live text format" properties each return a list of "text format record" items. You can set the entire cue to a single format, which will apply that format to all of the text. Or you can loop though the cue's existing list of formats, update each one, and then reapply those formats. There are also ways to format a substring range of characters or individual words.

The "text format record", "rgba color record", and "range record" types are all items at your disposal for formatting text. Be sure to check these out in the QLab AppleScript dictionary:

(The AppleScript (and OSC) hooks for Text cue were added in QLab 4.1, so also make sure your QLab version is up-to-date.)

I've attached a sample workspace that further demonstrates a variety of formatting scripts.

- Brent


Brent Lord

unread,
Oct 10, 2017, 1:44:46 PM10/10/17
to QLab
Aaaand that workspace I mentioned... :)

-b
Text Cue AppleScripting.qlab4.zip

benvr...@gmail.com

unread,
Oct 12, 2017, 1:48:27 AM10/12/17
to QLab
Thank you very much Brent! This is exactly what I needed. All the scripts in your workspace could come in handy, great stuff !

José Miguel Mayoral

unread,
Mar 30, 2020, 3:50:45 PM3/30/20
to QLab
Hi, Imagine that if i have to change the fonts of 100 text cues the scripts just affects to cue 1 how can i do to apply the script to the 100 cues? by changing the cue number in the script?


El martes, 10 de octubre de 2017, 19:44:46 (UTC+2), Brent Lord escribió:
Aaaand that workspace I mentioned... :)

-b

Imagine I have 100 text cues and I want to apply one of the scripts to all the cues, I see that in the script it only affects cue 1, how can I make it change all the cues? Do I have to modify the script with the cue number? 

Harry Halliday

unread,
Mar 30, 2020, 6:28:02 PM3/30/20
to ql...@googlegroups.com
If you need to change them all to the same font, you can change the font of one cue and then select all the others (perhaps using Cmd+A and then in the Basics tab selecting Text cues from the drop down on the top right), and then paste to the rest of the cues using Cmd+Shift+V, and selecting only “font” as the property to paste in the resulting pop up box. 

Does this make sense? 

Harry

--
Contact support anytime: sup...@figure53.com
Follow QLab on Twitter: https://twitter.com/QLabApp
User Group Code of Conduct: https://qlab.app/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/bcd133b5-ebe0-4741-9b53-93980a7135ff%40googlegroups.com.

micpool

unread,
Mar 30, 2020, 6:30:45 PM3/30/20
to QLab
Simplest is to change one text cue, and copy it  then select all text cues (select all and then filter to text cues using the pop up menu in the basics tab), then paste cue properties with the font and text color parameters ticked (aka fancy paste).

Mic

micpool

unread,
Mar 30, 2020, 6:35:38 PM3/30/20
to QLab
Ha, Harry and I were typing the identical solution at the same time.

If you wanted to adapt Brent's script to affect all text cues it would be

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

set theCues to cues whose q type is "text"

set theFormat to {rgbaColor:{red:1, green:0.5, blue:1, alpha:1}}

repeat with eachcue in theCues

set text format of eachcue to theFormat

end repeat

end tell

micpool

unread,
Mar 30, 2020, 6:47:18 PM3/30/20
to QLab
On Monday, March 30, 2020 at 11:35:38 PM UTC+1, micpool wrote:

If you wanted to adapt Brent's script to affect all text cues it would be

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

set theCues to cues whose q type is "text"

set theFormat to {rgbaColor:{red:1, green:0.5, blue:1, alpha:1}}

repeat with eachcue in theCues

set text format of eachcue to theFormat

end repeat

end tell




For completeness, theFormat is being set to a text format record, which is a list of all the properties that define the style of the text. So if you wanted to include a font and make it bold, white and 72 point you could have:

set theFormat to {fontFamily:"Courier", fontStyle:"Bold", fontSize:72, rgbaColor:{red:1, green:1, blue:1, alpha:1}}


Here's all the properties you can include:


tetext format recordn

properties

fontFamily (text) : The font family for this format. (e.g. "Helvetica", "Courier New")

fontStyle (text) : The font style (face) for this format. (e.g. "Regular", "Light Oblique")

fontName (text) : The font name for this format. (e.g. "CourierNewPS-BoldItalicMT")

fontSize (real) : The font size for this format.

lineSpacing (real) : The line spacing for this format.

rgbaColor (rgba color record) : An RGBA color record representing the percentage values for the red, green, blue, and alpha components of the text color of this format.

rgbaBackgroundColor (rgba color record) : An RGBA color record representing the percentage values for the red, green, blue, and alpha components of the background color of this format.

strikethroughStyle (text) : The strikethrough style of this format. Possible values are "none", "single", and "double".

strikethroughRgbaColor (rgba color record) : An RGBA color record representing the percentage values for the red, green, blue, and alpha components of the strikethrough color of this format.

underlineStyle (text) : The underline style of this format. Possible values are "none", "single", and "double".

underlineRgbaColor (rgba color record) : An RGBA color record representing the percentage values for the red, green, blue, and alpha components of the underline color of this format.

range (range record) : A range record representing the index and length for the substring that has this format.

wordIndex (integer) : An optional 1-indexed word number to which this format should be applied. When used, the "range" property will be ignored. (setting only)


 

Brent Lord

unread,
Sep 24, 2020, 4:15:34 PM9/24/20
to QLab
Noting here that previously we had listed "rgbaBackgroundColor" in the AppleScript dictionary as the property name for the background color of a text format record, but this was incorrect (and did not work).

As of the QLab 4.6.6 release, this is now fixed.
The correct property name to use going forward is "backgroundRgbaColor".

You can see an example script of how to use this property in this post:

Brent
Reply all
Reply to author
Forward
0 new messages