Scipt: How to change video input asignement with a single key

118 views
Skip to first unread message

Ivan Grigoriev

unread,
Mar 25, 2023, 11:42:29 AM3/25/23
to QLab
Hi
I have a show with three live cameras and one is giving troubles, so till I find the problem I would like to create a script that invoked with a keystroke changes video input patch to a backup source.
I've used simple scripts before but I usually fail on the syntax area :-)
Thanks in advance!

Ivan

micpool

unread,
Mar 25, 2023, 12:28:40 PM3/25/23
to QLab
Use OSC
(QLab 4)
/cue/{cue_number}/cameraPatch {number} 

QLab 5
/cue/{cue_number}/videoInputPatchNumber {number}

Mic

micpool

unread,
Mar 25, 2023, 12:35:05 PM3/25/23
to QLab
Or if you really need to script it

(QLab 4) set the camera patch of cue "1" to 1

(QLab 5) set the video input patch number of cue "1" to  1

Ivan Grigoriev

unread,
Mar 25, 2023, 3:06:17 PM3/25/23
to QLab
Hi Mic
I think I did't explained myself correctly in the post
I have multiple cues that use that input, so I want to change the patch itself in the preferences. 
To picture the exact situation in Patch 1 there is a Blackmagic Decklink Duo Input 1 assigned, I would like to change that input to a NDI input with a keystroke (I've tried doing it opening the preferences and it works)
Is it possible)
Thanks!



micpool

unread,
Mar 25, 2023, 4:11:53 PM3/25/23
to QLab

You can’t

Use the OSC with a wildcard e.g /cue/*/videoInputPatchNumber {number} and all the camera  cues will change input.

Mic

micpool

unread,
Mar 25, 2023, 4:14:00 PM3/25/23
to QLab
Although I said you can’t,  you could with UI scripting, which is fiddly and unreliable,

The OSC  wildcard method is probably as quick.


Mic

Ivan Grigoriev

unread,
Mar 25, 2023, 5:36:13 PM3/25/23
to QLab
OK, Can I select several non contiguous cues?
Message has been deleted

micpool

unread,
Mar 25, 2023, 5:47:15 PM3/25/23
to QLab
To do that you would need to number the cues with a prefix, so your Camera A cues might be numbered CAMA1… CAMA2 etc.

Then your wildcard to change only all CAMA cues would be /cue/CAMA*/videoInputPatchNumber {number} 

Ivan Grigoriev

unread,
Mar 25, 2023, 6:21:57 PM3/25/23
to QLab
you're "un capo!" (I'm from Argentina)
I've been trying with C1,C2,C3 and C1-C2-C3 with no luck. so I made a group with individual Cues for each change (there are 6) and it worked.
Now I'll fix it with the more elegant solution you gave.
Thanks!!!!

micpool

unread,
Mar 25, 2023, 8:17:26 PM3/25/23
to QLab
You can also use scripts to do this without having to number the cues  with a prefix

--to change every camera cue patched to Input 1 to input 4
tell application id "com.figure53.QLab.5" to tell front workspace
set theCamCues to cues whose q type is "camera" and video input patch number is 1
repeat with eachcue in theCamCues
set the video input patch number of eachcue to 4
end repeat
end tell

--to change every camera cue patched to Input 4 to input 1
tell application id "com.figure53.QLab.5" to tell front workspace
set theCamCues to cues whose q type is "camera" and video input patch number is 4
repeat with eachcue in theCamCues
set the video input patch number of eachcue to 1
end repeat
end tell

micpool

unread,
Mar 25, 2023, 8:46:43 PM3/25/23
to QLab
And for completeness here's how to UI script the video input patch, although because you need to have the settings open on the right tab, I don't recommend this for general use.


Screenshot 2023-03-26 at 00.42.37.png

--change Camera Patch in Settings/Video/Video Inputs window  WHICH MUST BE OPEN
tell application "System Events" to tell application process "QLab"
tell pop up button 1 of UI element 3 of row 1 of table 1 of scroll area 2 of (first window whose name contains "Settings") --Patch 1 is Row 1 Patch 2 is Row 2 etc.
click
delay 1 -- 1 sec is for demo use 0.2 for normal use
click menu item 8 of menu 1 --In Pop up menu count items from top including dividing lines and sub menu names
end tell
end tell

Screen recording attached

Mic

Screen Recording 2023-03-26 at 00.42.59.mov

Ivan Grigoriev

unread,
Mar 30, 2023, 9:16:16 AM3/30/23
to QLab
Thanks Mic
your explanation can't be more complete.
I'll stick with the OSC solution because it is already implemented, although the script  (not the UI one) is easier to implement on an already running cue list.
Regards!
Ivan
Reply all
Reply to author
Forward
0 new messages