Advertisement
duquesne9

Make OSC cue sheet Numbers

Aug 28th, 2018
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (*
  2. Tested with QLab v3.2.14 Oct 2018
  3. Please report any issues to robotlightsyou@gmail.com with subject "QLAB 3 template issues"
  4.  
  5. NEEDS:
  6. 1. Presently all midi LX cues show a program change of 60 in Numbers, this is inaccurate, midi LX cues do not affect Yamaha LS9 programs.
  7. *)
  8.  
  9.  
  10.  
  11. tell application id "com.figure53.QLab.4" to tell front workspace
  12.    
  13.    
  14.     set numList to {}
  15.     set nameList to {}
  16.     set targetList to {}
  17.     set contList to {}
  18.     set notesList to {}
  19.     set durList to {}
  20.     set typeList to {}
  21.     set oscList to {}
  22.     set mscList to {}
  23.     set mqlList to {}
  24.     set mVoiceList to {}
  25.    
  26.     repeat with eachQ in (selected as list)
  27.        
  28.         try
  29.             set numList to numList & ((q number of eachQ) as string)
  30.            
  31.             set nameList to nameList & (q name of eachQ)
  32.            
  33.             set targetList to targetList & (file target of eachQ)
  34.            
  35.             set notesList to notesList & (notes of eachQ)
  36.            
  37.             set contList to contList & (continue mode of eachQ)
  38.            
  39.             set durList to durList & (duration of eachQ)
  40.            
  41.             set typeList to typeList & (q type of eachQ)
  42.            
  43.             if q type of eachQ is "midi" then
  44.                
  45.                 try
  46.                     set mscList to mscList & (q_number of eachQ)
  47.                     set mqlList to mqlList & (q_list of eachQ)
  48.                     set mVoiceList to mVoiceList & (byte one of eachQ)
  49.                 end try
  50.             end if
  51.  
  52.             if q type of eachQ is not "midi" then
  53.                 set mscList to mscList & "--"                  
  54.                 set mqlList to mqlList & "--"
  55.                 set mVoiceList to mVoiceList & "--"
  56.            
  57.             if q type of eachQ is "osc" then
  58.                 set oscList to oscList & (custom message of eachQ)
  59.             end if
  60.        
  61.             if q type of eachQ is not "osc" then
  62.                 set oscList to oscList & "--"
  63.            
  64.         end try
  65.        
  66.     end repeat
  67.    
  68.     tell application "Numbers"
  69.        
  70.         set thisDocument to make new document with properties {document template:template "QLab"}
  71.         tell the first table of active sheet of document 1
  72.             set rowNum to "3"
  73.             set colName to "B"
  74.            
  75.             repeat with i from 1 to count numList
  76.                 set value of cell (colName & rowNum) to ((item i of numList) as string)
  77.                 set rowNum to rowNum + 1
  78.                
  79.             end repeat
  80.            
  81.             set rowNum to "3"
  82.             set colName to "C"
  83.            
  84.             repeat with i from 1 to count nameList
  85.                 set value of cell (colName & rowNum) to ((item i of nameList) as text)
  86.                 set rowNum to rowNum + 1
  87.                
  88.             end repeat
  89.            
  90.             set rowNum to "3"
  91.             set colName to "D"
  92.            
  93.             repeat with i from 1 to count durList
  94.                 set value of cell (colName & rowNum) to ((item i of durList) as text)
  95.                 set rowNum to rowNum + 1
  96.                
  97.             end repeat
  98.            
  99.             set rowNum to "3"
  100.             set colName to "E"
  101.            
  102.             repeat with i from 1 to count contList
  103.                 set value of cell (colName & rowNum) to ((item i of contList) as text)
  104.                 set rowNum to rowNum + 1
  105.                
  106.             end repeat
  107.            
  108.             set rowNum to "3"
  109.             set colName to "A"
  110.            
  111.             repeat with i from 1 to count typeList
  112.                 set value of cell (colName & rowNum) to ((item i of typeList) as text)
  113.                 set rowNum to rowNum + 1
  114.             end repeat
  115.            
  116.             set rowNum to "3"
  117.             set colName to "F"
  118.            
  119.             repeat with i from 1 to count notesList
  120.                 set value of cell (colName & rowNum) to ((item i of notesList) as text)
  121.                 set rowNum to rowNum + 1
  122.             end repeat
  123.            
  124.             --set keyList to keyList & (hotkey trigger of eachQ)
  125.             set rowNum to "3"
  126.             set colName to "G"
  127.            
  128.             repeat with i from 1 to count targetList
  129.                
  130.                 set value of cell (colName & rowNum) to ((item i of targetList) as text)
  131.                 if value of cell (colName & rowNum) is equal to "missing value" then
  132.                     set value of cell (colName & rowNum) to "--"
  133.                 end if
  134.                 set rowNum to rowNum + 1
  135.                
  136.             end repeat
  137.            
  138.             set rowNum to "3"
  139.             set colName to "H"
  140.            
  141.             repeat with i from 1 to count oscList
  142.                 set value of cell (colName & rowNum) to ((item i of oscList) as text)
  143.                 set rowNum to rowNum + 1
  144.                
  145.             end repeat
  146.            
  147.             set rowNum to "3"
  148.             set colName to "J"
  149.            
  150.             repeat with i from 1 to count mscList
  151.                 set value of cell (colName & rowNum) to ((item i of mscList) as text)
  152.                 set rowNum to rowNum + 1
  153.                
  154.             end repeat
  155.            
  156.             set rowNum to "3"
  157.             set colName to "I"
  158.            
  159.             repeat with i from 1 to count mqlList
  160.                 set value of cell (colName & rowNum) to ((item i of mqlList) as text)
  161.                 set rowNum to rowNum + 1
  162.                
  163.             end repeat
  164.            
  165.             set rowNum to "3"
  166.             set colName to "K"
  167.            
  168.             repeat with i from 1 to count mVoiceList
  169.                 set value of cell (colName & rowNum) to ((item i of mVoiceList) as text)
  170.                 set rowNum to rowNum + 1
  171.                
  172.             end repeat
  173.            
  174.         end tell
  175.     end tell
  176. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement