script

89 views
Skip to first unread message

E Forget

unread,
Jun 23, 2024, 4:29:20 PM (6 days ago) Jun 23
to QLab
Hi, 
I need to script the “set the level to “row 0 column 0”” but not randomly between all the values between ”themax“ and ”themin“, but randomly between two fix values.
Themax or themin only.
What's should I write to replace “set newLevel to (random number from themin to themax)”?  
Thank you
Éric

                set themax to -20
set themin to -30
repeat with eachCue in cues of theGroupCue
if q type of eachCue is in {"Audio"} then
set newLevel to (random number from themin to themax)
eachCue setLevel row 0 column 0 db newLevel
end if
end repeat

micpool

unread,
Jun 23, 2024, 6:25:51 PM (6 days ago) Jun 23
to QLab
Your random number generation and level setting are correct.

The complete script should be

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

set themax to -20

set themin to -30

set theGroupCue to last item of (selected as list)


repeat with eachCue in cues of theGroupCue

if q type of eachCue is "audio" then

set newLevel to (random number from themin to themax)

eachCue setLevel row 0 column 0 db newLevel

end if

end repeat

end tell




Rich Walsh

unread,
Jun 24, 2024, 7:25:22 AM (5 days ago) Jun 24
to ql...@googlegroups.com
If you just want to flip flop between two specific values at random use:

set newLevel to themin + (random number from 0 to 1) * (themax - themin)


I couldn’t find a more elegant way…

Rich
Message has been deleted

micpool

unread,
Jun 24, 2024, 7:43:23 AM (5 days ago) Jun 24
to QLab
Yes, this is the answer, sorry,  I had completely misread your original question

Mic

E Forget

unread,
Jun 24, 2024, 11:07:08 AM (5 days ago) Jun 24
to QLab
Thank you both for your quick response.
It so simple now and elegant.
é

micpool

unread,
Jun 24, 2024, 11:18:51 AM (5 days ago) Jun 24
to QLab
To make amends for my total misread of your original question I will also offer this which uses 'some item of list':


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

set levelsList to {-30, -20}

set theGroupCue to last item of (selected as list)

if the q type of theGroupCue is "group" then

repeat with eachCue in cues of theGroupCue

if q type of eachCue is "audio" then

eachCue setLevel row 0 column 0 db (some item of levelsList)

end if

end repeat

end if

end tell


which is easy to adapt for more than 2 possible levels e.g


set levelsList to {-3, -6,-9,-60}


Mic


On m'a Récupéré

unread,
Jun 24, 2024, 11:24:52 AM (5 days ago) Jun 24
to ql...@googlegroups.com
hahaha
Now I know, not one way, but two new ways. :)


--
Contact support anytime: sup...@figure53.com
Follow QLab on Threads: https://threads.net/@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/20fae714-52f2-49d9-9820-f3bfdea8a143n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages