1426298_51280144 copy.jpg

Blog

QLab 4 Color Picker

QLab 4 was released today. It doesn't include a native color picker for Light Cues. As an experiment, I added that functionality with a script cue. Here's a demo workspace.

QLab 4 is rad.

tell application id "com.figure53.QLab.4" to tell front workspace
    -- either 100 or 255
    set max to 100
    
    set selectedCue to last item of (selected as list)
    
    if (q type of selectedCue & "") is not "Light" then
        return
    end if
    
    
    set uglyInput to command text of selectedCue & ""
    set AppleScript's text item delimiters to {linefeed}
    set cleanerInput to text items of uglyInput
    set AppleScript's text item delimiters to {" "}
    set cleanerInput to cleanerInput as text
    set AppleScript's text item delimiters to " "
    set splitInput to every text item of cleanerInput
    set colorPick to choose color default color {65535, 65535, 65535}
    set divide to 65536 / max
    set outputString to ""
    set AppleScript's text item delimiters to "."
    
    set red to (first item of colorPick) / divide as integer
    set green to (second item of colorPick) / divide as integer
    set blue to (third item of colorPick) / divide as integer
    
    set x to 1
    repeat ((count of splitInput) - 1) times
        set parts to every text item of item x of splitInput
        if ((count of parts) is 2) then
            if (second item of parts is "Red") then
                set item (x + 2) of splitInput to red & ""
            end if
            if (second item of parts is "Green") then
                set item (x + 2) of splitInput to green & ""
            end if
            if (second item of parts is "Blue") then
                set item (x + 2) of splitInput to blue & ""
            end if
            set item (x + 2) of splitInput to (item (x + 2) of splitInput) & linefeed
        end if
        set x to x + 1
    end repeat
    
    set AppleScript's text item delimiters to " "
    set Final to splitInput as text
    
    set command text of selectedCue to Final
    prune selectedCue
end tell
Alec Sparks