quad backslash

80 views
Skip to first unread message

Kalman Tarr

unread,
Feb 27, 2023, 12:23:58 PM2/27/23
to QLab
Hi Qlabers,

I am using the next OSC command:
/cue/memo/notes "#/cue/sound/sliderLevels#".
It is gets the slider levels. OK.
I would like to get the values one by one but find some special characters around and between values. This is character '⍂'.
I read about this symbol, they named Apl Functional Symbol Quad Backslash. The question is how can I use the character to separate the values in the string. Using the 'applescript's text item delimiters' feature. I tried to use:
set my AppleScript's text item delimiters to "&#9026" as Unicode text
Not working. :-(
Thanks in advance for the advice.

Best
Kalman

Sam Kusnetz

unread,
Feb 27, 2023, 2:07:57 PM2/27/23
to ql...@googlegroups.com
Hi Kalman

What happens if you 

set my AppleScript's text item delimiters to “\\”

?

The backslash is an “escape” character, which means “do not interpret the special meaning of the next character, just treat it as a regular character.”

If you just type “\” it won’t work because AppleScript thinks you’re just escaping the second double quotation mark. So you need to type “\\” so that the first backslash tells AppleScript to treat the SECOND backslash as a regular character.

Best
Sam
Sam Kusnetz (he/him) | Figure 53

Kalman Tarr

unread,
Feb 27, 2023, 3:12:48 PM2/27/23
to QLab
Hi Sam,

Maybe it makes simple if I give the OSC answer:
⍂-9.208934243790743⍂-5.739859621038774⍂-8.38644440919645⍂
I forgot to mention in my previous post.
Sam, I tried to use your advice but nothing.
It just doesn't work for me???
I'll give you the full script.
set theLevels to notes of cue "memo"
set my AppleScript's text item delimiters to "\\"
set thePieces to text items of theLevels
It makes me sad.
Kalman

micpool

unread,
Feb 27, 2023, 3:14:20 PM2/27/23
to QLab
I think you are just heading for trouble with this, as there is no consistent behaviour coercing an array to text as you are attempting.

In QLab 5 I can't get anything from an array  to appear in the notes 

In QLab 4 with a newly created cue with all sliders at 0, I get a comma operated list in round brackets

(
0,
0,
0,

etc.

0,
)

If I change any of the slider levels I get just those non zero slider values (omitting any sliders at 0dB in between)  separated by ⍂  

12.00000001102151-2.113449172503242-30.45731192972124-12.17275103663576-34.39608015478124



This can be parsed in the normal way, by removing the first and last character of the string and then  copying and pasting the quad backslash e.g.

set a to "12.00000001102151-2.113449172503242-30.45731192972124-12.17275103663576-34.39608015478124"


set AppleScript's text item delimiters to ""


return text item 3 of a


will return "-30.45731192972124"





I'd use a script to get the 65 slider levels, space separated in the first place, like this:

tell application id "com.figure53.QLab.4" to tell front workspace
set a to {}
repeat with x from 0 to 64
set the end of a to ((getLevel cue "sound" row 0 column x) as text) & " "
set the notes of cue "memo"  to a as text
end repeat
end tell



Mic

Kalman Tarr

unread,
Feb 28, 2023, 3:05:31 AM2/28/23
to QLab
Thanks Mic for advices,

I've done your first advice. When I copy the quad backslash character '⍂' and compile the script. The character will change to '?' 
'set AppleScript's text item delimiters to "?"'
When run the script it is generate an error. Shown in the pics.

ErrorGen.png

The second part of your answer (the script) is working good!! Hurray.

Ok. However I have a question that I do not understand from the beginning that I tryed to work with OSC commands. There are OSC commands called queries. Like my OSC.
OK. I run them and what happens after it answering. How can I get the answer or part of answer. I know, I don't have enough knowledge on them. The problem corresponds to the original question. If I know how can I get the parts of the answer than everything is good. But I don't know. Teach me please. A link ???

Sincerely
Kalman

Kalman Tarr

unread,
Feb 28, 2023, 4:51:43 AM2/28/23
to QLab
Hi Mic and Sam,

I tried to understand the problem. In my experience, if I change in the script anything , a number or elseone, running the script makes error until I copy and past again the quad BS. I tried to avoide the error with this line: 'set AppleScript's text item delimiters to text 1 thru 1 of (get notes of cue "memo")' it gets the first character the quad BS and embed it over and over again. This way the script do not generate error. At the end of script we place all data into a list variable.

The full script:

tell application id "com.figure53.QLab.4" to tell front workspace
set theLevel to text 2 thru -2 of (get notes of cue "memo")
display dialog theLevel as text
set AppleScript's text item delimiters to text 1 thru 1 of (get notes of cue "memo")
--"?"
set a to text items of theLevel
set level_Data to {}
repeat with n from 1 to count of a
set end of level_Data to text item (n) of a
end repeat
display dialog (count of level_Data) as text
end tell

It is just a kind of mind game for me. I've like to know more and more things about OSCs and scripts.
I say Thanks for many helps, Sam, Mic, Rich and Chris.

Best 
Kalman

micpool

unread,
Feb 28, 2023, 6:39:26 AM2/28/23
to QLab
I've had a quick look at this and found:

QLab 5 won't display arrays as text in notes fields but QLab 4 will. 

Script Editor.app recognises and compiles the quad backslash character '⍂'  but the compiler in QLab changes the character to ?. However, this substitution is still usable as you have shown in your script.

SliderLevels in an OSC query will not produce an array of 65 levels when you try to display them as text in a notes field in QLab 4 (unless all levels are at 0)

I don't know the reasons for any of the above, but note fields are intended to display text. Your OSC query doesn't return text, so you can attempt to get it to work using the 'enclose OSC query in quotes' method, but this is an unofficial  workaround and, as you can see doesn't, always do what you want, or, in QLab 5, display anything.

As you are trying to push QLab beyond the range of things that are documented or tested to function correctly, then the quickest  thing to do is find an alternative method of achieving the same thing which can often be done much better  with scripting.

OSC queries are useful in QLab for getting values of parameters that aren't included in the AppleScript dictionaries, but as you are going to use AppleScript to process  these results anyway, if the parameter value can be returned in a script you might as well keep the whole thing scripted, rather than use  an OSC query/AppleScript hybrid.


Mic

Sam Kusnetz

unread,
Feb 28, 2023, 10:56:24 AM2/28/23
to ql...@googlegroups.com
On Feb 28, 2023 at 6:39:26 AM, micpool <m...@micpool.com> wrote:
Ok. However I have a question that I do not understand from the beginning that I tryed to work with OSC commands. There are OSC commands called queries. Like my OSC.
OK. I run them and what happens after it answering. How can I get the answer or part of answer. I know, I don't have enough knowledge on them. The problem corresponds to the original question. If I know how can I get the parts of the answer than everything is good. But I don't know. Teach me please. A link ???

OSC queries are discussed in the manual here:

The purpose of an OSC query is to help you build an OSC message using the results of another OSC message. They are limited by data type, so the reason you’re having trouble is that /sliderLevels returns an array, and /notes is expecting a string.

As Mic says, since you’re working in AppleScript in the first place, it’s better to use AppleScript to get the data you want, process it how you want, and then do whatever you want to do with the result.

Kalman Tarr

unread,
Mar 1, 2023, 2:56:44 AM3/1/23
to QLab
Hi Sam and Mic,
Thank you both for your replies.
As always in the past, I received useful informations from you.
It's not a coincidence.
Ok, thanks again. Good work for today.
Best,
Kalman
Reply all
Reply to author
Forward
0 new messages