Applescript

Scripting!

Happy 2016, everybody!

I'm in tech for my next show at IRT, The mystery of Irma Vep - 1991's most produced play and longest-running show in Brazil! The show features some great organ music by composer/sound designer Lindsay Jones, so come on down and check it out if you're in the area. Recently, IRT's resident sound designer and I were talking about QLab, and he mentioned how it would be nice to have a simple way of exporting a cue sheet from QLab, to give to stage managers. I had been looking for a project, so I thought this sounded like an excellent test case for teaching myself some Applescript. And, lo and behold, it works!

Here's a link to the .scpt file, or you can copy/paste/compile your own:


-- Export a simple cue sheet from a QLab cue list
-- Jason Tuttle
-- This script will export the cue number and name of all selected cues to a comma-delimited (.csv) text file,
-- which can be imported to any common spreadsheet program (Excel, Numbers, OpenOffice, etc...)

tell application id "com.figure53.qlab.3" to tell front workspace

   set AppleScript's text item delimiters to ASCII character 44 --comma, change to 9 for tab-delim
   global oneCue

   set theFile to choose file name with prompt "Name the .csv file" default name "New Cue Sheet.csv"
   set referenceNumber to open for access theFile with write permission
   set header to {"Cue #", "Cue Name", "Notes" & return} as string
   write header to theFile starting at eof

   repeat with eachCue in (selected as list)
     try --if you want to expand the number of fields to export, do so here
       set thisqnumber to q number of eachCue
       set thisqname to q list name of eachCue
       set thisqnotes to notes of eachCue
       set oneCue to {thisqnumber, thisqname, thisqnotes} as string --you'd have to add extra fields here
      write (oneCue & return) as text to theFile starting at eof
      on error error_message number error_number --just in case something goes wrong...
      display dialog "Error" & error_number & ": " & error_message buttons {"OK"} default button 1
    end try

  end repeat

   close access referenceNumber --close access to the file we opened

   set AppleScript's text item delimiters to "" ---reset to nothing

end tell

So, there it is. It's pretty simple, but it works. If you download or use it, let me know. If you make improvements on it, let me know. If you have a feature request, let me know that, too, and I'll see if I can make it happen.

Happy scripting!