Advertisement
duquesne9

Collate by number, WIP

Jul 4th, 2019
1,277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- COLLATE ADD GROUPS, LX, SFX, PROJ
  2. global dialogTitle, sharedPath, numCues
  3. set dialogTitle to "Collate Cue lists - CAUTION"
  4. --set numCues to "2"
  5. set numCues to my enterSomeText("WARNING: If top level cue is not group, any attempt to add new cue to that number will delete the new cue
  6.  
  7. How many groups?", "2", false)
  8.  
  9. tell application id "com.figure53.qlab.3" to tell front workspace
  10.     repeat with g from 10 to numCues by 5
  11.         make type "group"
  12.         set newGroup to last item of (selected as list)
  13.         set properties of newGroup to {q name:"Cue " & g, q number:g, mode:fire_all}
  14.     end repeat
  15.    
  16.     -------------------------
  17.     --MOVE INTO GROUPS--
  18.     -------------------------
  19.    
  20.     delay 0.1
  21.     tell application "System Events"
  22.         keystroke "a" using {command down}
  23.     end tell
  24.    
  25.    
  26.     set numCues to my enterSomeText("WARNING: If top level cue is not group, any attempt to add new cue to that number will delete the new cue
  27.  
  28. Highest number of an SFX Cue?", "2", false)
  29.    
  30.     repeat with eachQ in (selected as list)
  31.         set eachQID to uniqueID of eachQ
  32.         repeat with p from 10 to numCues by 5
  33.             if q number of eachQ ends with p & ".SFX" then
  34.                 move cue id eachQID of parent of eachQ to end of cue (p as text)
  35.             end if
  36.             --exit repeat
  37.         end repeat
  38.     end repeat
  39.    
  40.     set numCues to my enterSomeText("WARNING: If top level cue is not group, any attempt to add new cue to that number will delete the new cue
  41.  
  42. Highest number of an LX cue?", "2", false)
  43.    
  44.     tell application id "com.figure53.qlab.3" to tell front workspace
  45.        
  46.         -------------------------
  47.         --MOVE INTO GROUPS--
  48.         -------------------------
  49.        
  50.         repeat with eachQ in (selected as list)
  51.             set eachQID to uniqueID of eachQ
  52.             repeat with p from 10 to numCues by 5
  53.                 if q number of eachQ ends with p & ".LX" then
  54.                     move cue id eachQID of parent of eachQ to end of cue (p as text)
  55.                 end if
  56.                 --exit repeat
  57.             end repeat
  58.         end repeat
  59.     end tell
  60.    
  61.     set numCues to my enterSomeText("WARNING: If top level cue is not group, any attempt to add new cue to that number will delete the new cue
  62.  
  63. Highest number of a Proj Cue?", "2", false)
  64.    
  65.     tell application id "com.figure53.qlab.3" to tell front workspace
  66.        
  67.         -------------------------
  68.         --MOVE INTO GROUPS--
  69.         -------------------------
  70.        
  71.         repeat with eachQ in (selected as list)
  72.             set eachQID to uniqueID of eachQ
  73.             repeat with p from 10 to numCues by 5
  74.                 if q number of eachQ ends with p & ".PROJ" then
  75.                     move cue id eachQID of parent of eachQ to end of cue (p as text)
  76.                 end if
  77.                 --exit repeat
  78.             end repeat
  79.         end repeat
  80.        
  81.     end tell
  82. end tell
  83.  
  84.  
  85. on enterSomeText(thePrompt, defaultAnswer, emptyAllowed) -- [Shared subroutine]
  86.     tell application id "com.figure53.QLab.3"
  87.         set theAnswer to ""
  88.         repeat until theAnswer is not ""
  89.             set theAnswer to text returned of (display dialog thePrompt with title dialogTitle default answer defaultAnswer buttons {"Cancel", "OK"} ¬
  90.                 default button "OK" cancel button "Cancel")
  91.             if emptyAllowed is true then exit repeat
  92.         end repeat
  93.         return theAnswer
  94.     end tell
  95. end enterSomeText
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement