Advertisement
duquesne9

Set q color based on q type QLab3

Jun 20th, 2018
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (*
  2.  
  3. This script intednded to add cue colors to all selected cues based on the type of cue.
  4.  
  5. v2 UPDATE: I realize it's only been a few hours, but I have a partial fix for the issue of applying color to all selected cues. Added variable for selected cue to myOSC string that limits to chosen cue as long as chosen cue is numbered. If it is not numbered, it will apply color to all unnumbered cues.*)
  6.  
  7.  
  8.  
  9. tell application id "com.figure53.QLab.3" to tell front workspace
  10.     set selectedCues to (selected as list)
  11.     repeat with targetQ in selectedCues
  12.         --set newQ to current in selectedCues
  13.         (*
  14.        
  15.         if q type of targetQ is "group" then
  16.             set myColor to "green"
  17.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  18.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  19.         else if q type of targetQ is "osc" or "midi" or "midi file" or "timecode" then
  20.             set myColor to "blue"
  21.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  22.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"  
  23.         else if q type of targetQ is "audio" or "video" or "mic" or "camera" or "text" or "fade" then
  24.             set myColor to "purple"
  25.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  26.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  27.         else if q type of targetQ is "stop" or "start" or "goto" or "devamp" or "load" or "pause" or "reset" or "target" then
  28.             set myColor to "gray"
  29.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  30.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  31.         else if q type of targetQ is "arm" or "disarm" or "wait" then
  32.             set myColor to "orange"
  33.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  34.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  35.         else if q type of targetQ is "memo" then
  36.             set myColor to "yellow"
  37.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  38.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  39.         end if
  40.        
  41.         *)
  42.         set colorQ to q number of targetQ
  43.         if q type of targetQ is "group" then
  44.             set myColor to "green"
  45.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  46.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  47.            
  48.         else if q type of targetQ is "osc" then
  49.             set myColor to "blue"
  50.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  51.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  52.         else if q type of targetQ is "midi" then
  53.             set myColor to "blue"
  54.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  55.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  56.         else if q type of targetQ is "midi file" then
  57.             set myColor to "blue"
  58.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  59.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  60.         else if q type of targetQ is "timecode" then
  61.             set myColor to "blue"
  62.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  63.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  64.            
  65.         else if q type of targetQ is "audio" then
  66.             set myColor to "purple"
  67.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  68.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  69.         else if q type of targetQ is "video" then
  70.             set myColor to "purple"
  71.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  72.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  73.         else if q type of targetQ is "camera" then
  74.             set myColor to "purple"
  75.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  76.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  77.         else if q type of targetQ is "text" then
  78.             set myColor to "purple"
  79.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  80.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  81.         else if q type of targetQ is "mic" then
  82.             set myColor to "purple"
  83.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  84.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  85.         else if q type of targetQ is "fade" then
  86.             set myColor to "purple"
  87.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  88.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  89.            
  90.            
  91.         else if q type of targetQ is "target" then
  92.             set myColor to "gray"
  93.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  94.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  95.         else if q type of targetQ is "stop" then
  96.             set myColor to "gray"
  97.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  98.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  99.         else if q type of targetQ is "start" then
  100.             set myColor to "gray"
  101.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  102.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  103.         else if q type of targetQ is "goto" then
  104.             set myColor to "gray"
  105.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  106.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  107.         else if q type of targetQ is "devamp" then
  108.             set myColor to "gray"
  109.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  110.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  111.         else if q type of targetQ is "load" then
  112.             set myColor to "gray"
  113.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  114.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  115.         else if q type of targetQ is "pause" then
  116.             set myColor to "gray"
  117.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  118.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  119.         else if q type of targetQ is "reset" then
  120.             set myColor to "gray"
  121.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  122.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  123.            
  124.            
  125.         else if q type of targetQ is "arm" then
  126.             set myColor to "orange"
  127.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  128.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  129.         else if q type of targetQ is "disarm" then
  130.             set myColor to "orange"
  131.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  132.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  133.         else if q type of targetQ is "wait" then
  134.             set myColor to "orange"
  135.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  136.             do shell script "echo " & myOSC & " | nc -u -w 0 127.0.0.1 53535"
  137.            
  138.         else if q type of targetQ is "memo" then
  139.             set myColor to "yellow"
  140.             set myOSC to "/cue/{" & colorQ & "}/colorName " & myColor
  141.             do shell script "echo " & myOSC & " | nc -u  -w 0 127.0.0.1 53535"
  142.         end if
  143.        
  144.     end repeat
  145.    
  146. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement