Create and modify Cue list, Applescript

122 views
Skip to first unread message

Meinland Kohlrabi

unread,
Sep 28, 2025, 9:58:01 AM (12 days ago) Sep 28
to QLab
Hello ya' all,

I am trying to create a script that creates a list and changes its name. That is all, but even with chattGPT and reading docs I could not get it done. What seems to be an easy job has become a challenge that I cannot solve on my own. Tha's why I'm posting here:

Overall target is to have a seperate lists, that takes my csv exported light cues from eos and turns them into a list of network cues. So here is my script. 

Thanks in advance

micpool

unread,
Sep 28, 2025, 11:11:29 AM (12 days ago) Sep 28
to QLab

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

set listName to "fred"

set cueListExists to false

repeat with cl in cue lists

if q name of cl is listName then

set cueListExists to true

exit repeat

end if

end repeat

if cueListExists is false then

make type "cue list"

set newCue to last item of cue lists

set q name of newCue to listName

end if

end tell

Paul

unread,
Sep 28, 2025, 1:25:09 PM (12 days ago) Sep 28
to QLab
Here is my script which will import EOS cues and create Network cues in Qlab for OSC triggers for them (ignoring follow on cues). This includes making a cue list if it doesn't already exist and renaming it.

-- Import a CSV file of EOS cues and make OSC triggers for them


-- this script assumes you have a Network Patch named EOS in QLab Settings->Network



set EOSinst to "From CIA select File - Export - CSV and select location (eg USB stick). Deselect All, then select Cues, click OK  and enter file name and press Enter. Copy the csv files to Mac and then run this script. Configure Network and OSC on EOS/Desk and QLab/Mac"

display dialog EOSinst with title "To Export a Cues file from EOS"


-- set the seperator, for CSV generally comma 

set sep to ","


-- Note: inside the tell Qlab the choose file only works with Posix form which is longer


set myfile to (choose file with prompt "Please select a CSV file containing EOS cues" of type {"csv"} default location (path to desktop))


-- while testing, specify the csv file directly

--set myfile to ((path to desktop) as string) & "eoscues.csv"


-- read the lines of file into an array

set myArray to every paragraph of (read file myfile)

--set myArray to every paragraph of (read POSIX file myFile) 



set AppleScript's text item delimiters to sep

set cueinfo to {}

set ignoredCues to {}

set errors to {}

set nextFollows to false

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

set myCuelistName to "EOS Imported"

try

set myCuelist to first cue list whose q name is myCuelistName

on error

display dialog "Cue list " & myCuelistName & " does not exist - do you want to create it" as string buttons {"Cancel", "Create Cue List"}

make type "cuelist"

set myCuelist to first cue list whose q name is "Cue List"

set q name of myCuelist to myCuelistName

end try

set current cue list to myCuelist


repeat with myline in myArray

-- split the line into an array on the comma separator

set myitems to every text item of myline

-- get the EOS specific columns

try

-- check if this is a Cue item

if (item 2 of myitems) is "Cue" then

set lxcuelist to item 3 of myitems

set lxcuenum to item 4 of myitems

set lxlabel to item 7 of myitems

set lxdur to item 18 of myitems

-- need to check these values so not to create triggers for part cues or follow on cues

set follow to item 24 of myitems

set part to item 6 of myitems

set lxnotes to item 32 of myitems

set lxscene to item 33 of myitems

if lxlabel is "" then

set lxlabel to "(no label) "

end if

if not nextFollows and part is "" then

make type "Network"

set newCue to last item of (selected as list)

set q number of newCue to "LX " & lxcuenum

set network patch name of newCue to "EOS"

set parameter values of newCue to "/eos/cue/" & lxcuelist & "/" & lxcuenum & "/fire"

-- flag snap cues

if lxdur is "0" then

set timelabel to " SNAP!"

set (q color of newCue) to "Orange"

else

set timelabel to " (" & lxdur & "s) "

end if

set q name of newCue to "LX" & lxcuenum & " - " & lxlabel & timelabel & " " & follow

set end of cueinfo to lxcuenum & " - " & lxlabel & timelabel & " " & follow & " " & part

else

set end of ignoredCues to lxcuenum & " - " & lxlabel & timelabel & " " & follow & " " & part

end if

-- check if follow has a value, so we don't create trigers for auto follow cues

if follow is "" then

set nextFollows to false

else

set nextFollows to true

end if

end if

on error errorMessage

set end of errors to errorMessage

end try

end repeat

set nl to linefeed

set AppleScript's text item delimiters to linefeed

display dialog (cueinfo as text) & nl & nl & (length of errors) & nl & "Ignored (autofollow, parts)" & nl & (ignoredCues as text) & nl & " errors" & nl & (errors as text) with title "Made " & (length of cueinfo) & " EOS trigger cues"

end tell


Meinland Kohlrabi

unread,
Sep 28, 2025, 6:10:47 PM (12 days ago) Sep 28
to QLab
Hey, thanks for your prompt responses. This saves me a lot of time. I am very grateful.

Still I am experiencing a few issues with the script @Paul provided:
(excuse me as I don't know how to fancy format the code.)


First issue:

for me the expression:
if follow is "" then … 

does not evaluate to true. strangely it's false. Hence except for the first que any other que will be skipped. I added this line to debug:

log "----- " & lxcuenum & " -----"
log "part is:" & part
-- this is ""
log "follow is: " & follow
-- this is false even though I expect it to be true, because how can a NULL character ever be something more than ""??? log follow is ""
repeat with i from 1 to length of follow
-- this is 0
log "Char " & i & ": " & (ASCII number of character i of follow)
end repeat
-- only this is true
                                log (ASCII number of follow) is 0


Second Issue


Even with the minimalst version of the code I cannot get the varaibles properly pasted in the newly created cue.
Qlab will create a Que, but neither will it add the q number nor the name.

I will append a screenshot of the result created with a slightly modified version of your code to bypass above issue and the csv file I use for testing.

I appreceate any help 
test_cues.csv
Screenshot 2025-09-29 at 00.04.11.png

Paul

unread,
Sep 29, 2025, 12:12:00 PM (11 days ago) Sep 29
to QLab
Hi Meinland
thanks for posting you test data csv file.  That does cause my script to fail. Examining the file shows blank fields 
have a null character (byte 00) between commas while the file I was testing with had nothing between commas of blank fields. 
This means that the test for follow on or part cues fields doesn't not work as intended.  

Here is a dump of part of your CSV file, you can see all the null 00 chapters

00000390: 2c00 2c00 0a00 3100 2c00 4300 7500 6500  ,.,...1.,.C.u.e.

000003a0: 2c00 3100 2c00 3100 2c00 4400 3100 3500  ,.1.,.1.,.D.1.5.

000003b0: 3300 4500 3100 4500 3900 2d00 3400 4600  3.E.1.E.9.-.4.F.

000003c0: 4300 3300 2d00 3400 4600 3700 3400 2d00  C.3.-.4.F.7.4.-.

000003d0: 3900 3900 4600 4400 2d00 4200 3900 3700  9.9.F.D.-.B.9.7.

000003e0: 4300 4100 4500 3800 3600 3200 3500 4100  C.A.E.8.6.2.5.A.

000003f0: 3100 2c00 2c00 4500 6900 6e00 6c00 6100  1.,.,.E.i.n.l.a.

00000400: 7300 7300 2c00 3500 2c00 2c00 2c00 2c00  s.s.,.5.,.,.,.,.

00000410: 2c00 2c00 2c00 2c00 2c00 2c00 3500 2c00  ,.,.,.,.,.,.5.,.

00000420: 2c00 2c00 2c00 2c00 2c00 2c00 2c00 2c00  ,.,.,.,.,.,.,.,.

00000430: 2c00 2c00 2c00 2c00 2c00 2c00 2c00 2c00  ,.,.,.,.,.,.,.,.

00000440: 2c00 2c00 0a00 3100 2c00 4300 7500 6500  ,.,...1.,.C.u.e


And here is a dump of some similar part the test data I was using, which came from EOS 3.2.9 on MacOS; notice it doesn't have the extra null characters

000001c0: 2c2c 2c2c 2c0a 312c 4375 652c 312c 312c  ,,,,,.1,Cue,1,1,

000001d0: 4130 3137 4430 3630 2d31 3330 462d 3445  A017D060-130F-4E

000001e0: 3031 2d38 4130 412d 3746 3944 3135 3034  01-8A0A-7F9D1504

000001f0: 3643 4633 2c2c 4f6e 652c 352c 2c2c 2c2c  6CF3,,One,5,,,,,

00000200: 2c2c 2c2c 2c35 2c2c 2c2c 2c2c 2c2c 2c2c  ,,,,,5,,,,,,,,,,

00000210: 2c2c 2c2c 2c2c 2c2c 2c0a 312c 4375 652c  ,,,,,,,,,.1,Cue,


 I guess ETC changed the way it did the CSV export at some point.
Now this could be due a different version of EOS or it could be a Windows/Mac thing; what version of EOS did your test data come from?
did it come direct from the console? or Nomad on Windows or Mac?

I am updating the script to work with your version of the data and will post another version here shortly.

Paul

unread,
Sep 29, 2025, 1:30:57 PM (11 days ago) Sep 29
to QLab
Ok, it's slightly tricker than I at first thought, as all the fields had extra nulls! So a quick fix might to remove the nulls in the file (although that is not a simple as it might first appear). You can remove the nulls with this command at the Terminal command line

cat test_cues.csv | xxd -p | sed 's/00//g' | xxd -r -p  > test_nonulls.csv


Brief explanation of this sequence of commands:

 cat - show the contents of the file; pipe | into  xxd - with the -p option dumps the file as bytes; sed - stream editor, substitutes the 00 for the nothing; xxd -r -p reads the bytes back in; then > sends the output to a new file.


attached is the converted file.


That will be a quick fix to make the script work, and when I get time I will look to see if I can deal that data file directly in the script. Be interesting to know what version of EOS it came from and if anything else was used to process in between (spreadsheet or whatever).


test_nonulls.csv

Paul

unread,
Sep 29, 2025, 4:18:49 PM (11 days ago) Sep 29
to QLab
Here's a version of the script which will import an EOS Cues CSV file containing nulls and make Network cues with OSC to trigger the EOS cues. Tested this will your 'test_cues.csv' file and it seems to work. You'll see there is a kludge which removes the nulls from the line near the beginning of the repeat loop. I have only minimally tested this, so back up your workspace before using.

-- Import a CSV file of EOS cues and make OSC triggers for them

---  this version handles export csv file containing nulls



-- as a work around can remove nulls from the original file using the rather convoluted

-- cat test_cues.csv | xxd -p | sed 's/00//g' | xxd -r -p  > test_nonulls.csv

-- [ unfortunately sed 's/\x0//g' doesn't work, at least on MacOS ]

-- this script assumes you have a Network Patch named EOS in QLab Settings->Network



set EOSinst to "From CIA select File - Export - CSV and select location (eg USB stick). Deselect All, then select Cues, click OK  and enter file name and press Enter. Copy the csv files to Mac and then run this script. Configure Network and OSC on EOS/Desk and QLab/Mac"

--display dialog EOSinst with title "To Export a Cues file from EOS"


-- set the seperator, for CSV generally comma 

set sep to ","



set myfile to (choose file with prompt "Please select a CSV file containing EOS cues" of type {"csv"} default location (path to desktop))


-- read the lines of file into an array

set myArray to every paragraph of (read file myfile)


set AppleScript's text item delimiters to sep

set cueinfo to {}

set ignoredCues to {}

set errors to {}

set nextFollows to false

set nl to linefeed

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

set myCuelistName to "EOS Imported"

try

set myCuelist to first cue list whose q name is myCuelistName

on error

display dialog "Cue list " & myCuelistName & " does not exist - do you want to create it" as string buttons {"Cancel", "Create Cue List"}

make type "cuelist"

set myCuelist to first cue list whose q name is "Cue List"

set q name of myCuelist to myCuelistName

end try

set current cue list to myCuelist

set nextFollow to false

set results to {}

repeat with myline1 in myArray

------- kludge to remove nulls from string split the line on nulls to remove them

set AppleScript's text item delimiters to AppleScript's character id (0)

set tempArr to (every text item of myline1)

-- then rejoin the string without them

set AppleScript's text item delimiters to ""

set myline to tempArr as text

---------------- end of kludge ------------

-- split the line into an array on the comma separator

set AppleScript's text item delimiters to sep

set myitems to every text item of myline

set AppleScript's text item delimiters to linefeed

try

set rowtype to text item 2 of myitems

--display dialog (myitems as text) with title "my items, row type " & rowtype

if item 2 of myitems is "Cue" then

set part to item 6 of myitems

if not nextFollow and part is "" then

set lxcuelist to text item 3 of myitems

set lxdur to item 18 of myitems

set lxcuenum to item 4 of myitems

set lxlabel to item 7 of myitems

set follow to item 24 of myitems

set end of results to (lxcuenum & space & lxlabel) as string

set pv to ("/cue/" & lxcuelist & "/" & lxcuenum & "/fire") as string

make type "Network"

set netCue to last item of (selected as list)

set network patch name of netCue to "EOS"

set parameter values of netCue to pv

set q number of netCue to "LX" & lxcuenum

-- highlight snap cues

if lxdur is "0" then

set timelabel to " SNAP!"

set (q color of netCue) to "Orange"

else

set timelabel to " (" & lxdur & "s) "

end if

set q name of netCue to ("LX" & lxcuenum & " - " & lxlabel & timelabel & " " & follow) as string

else

set end of ignoredCues to (lxcuenum & space & label) as string

end if

-- don't make triggers for follow on cues

-- [this has not been tested with new data]

if follow is "" then

set nextFollow to false

else

set nextFollow to true

end if

end if

on error errMesg

set end of errors to errMesg

end try

end repeat

set nl to linefeed

set AppleScript's text item delimiters to linefeed

display dialog (results as text)

--display dialog (cueinfo as text) & nl & nl & (length of errors) & nl & "Ignored (autofollow, parts)" & nl & (ignoredCues as text) & nl & " errors" & nl & (errors as text) with title "Made " & (length of cueinfo) & " EOS trigger cues"

end tell


Rich Walsh

unread,
Sep 30, 2025, 4:18:07 AM (10 days ago) Sep 30
to ql...@googlegroups.com
You might find the problem goes away if you use this line to ingest the file:

set myArray to paragraphs of (read file myfile as Unicode text)


I think the file is UTF-16 so every character is using two bytes instead of one.

Rich

Paul

unread,
Sep 30, 2025, 11:35:57 AM (10 days ago) Sep 30
to QLab
Thanks Rich, yes indeed reading as Unicode text does fix the problem.
Any idea how to tell the difference between a UTF-16 and other (UTF-8) files?  Reading the original data file does not give an error that you could catch with try, instead just lands up reading garbage.

Rich Walsh

unread,
Sep 30, 2025, 12:03:48 PM (10 days ago) Sep 30
to ql...@googlegroups.com
This looks like the best bet: https://www.macscripter.net/t/parsing-utf-8-and-utf-16/57205/2. I can’t seem to easily create any files that refuse to be read as «class utf8» except those explicitly saved as UTF-16.

Rich

Meinland Kohlrabi

unread,
Sep 30, 2025, 5:31:54 PM (10 days ago) Sep 30
to QLab
Okay Guys, thanks for joining the discussion and helping me to tackle the problem.
I now found, why the original script of Paul's didn't work in the first place:

In EOS export you can define how your export is encoded. 

I changed the default value ASCII/Latin to UTF16 to tackle a different issue I had with EOS and never reversed it to ASCII.

Now that I changed the export settings the script works perfectly fine
Thanks for your support

Kind regards 
Meinland
Screenshot 2025-09-30 at 23.29.01.png
Reply all
Reply to author
Forward
0 new messages