This is an "external script" - see QLab Scripts and Macros
# All purpose enquiry
--
set theExplanation to "This script allows you to present practically any possible query to the current QLab workspace, so as to find all cues (including cue lists) " & ¬
"whose \"X\" is, or contains, \"Y\".
Where appropriate, \"is greater than\", \"is less than\" and others will also be offered as choices.
The results can be copied to the Clipboard, saved as a text file or batch adjusted - or you can jump to the found cues (not cue lists) one at a time until you give up."
--
(* This script is not designed to be run from within QLab!
v1.0: 31/01/10 Rich Walsh
<<< Last tested with: QLab 2.2.6; Mac OS 10.5.8 & 10.6.2 >>> *)
-- ###BUG TBC### Not very thoroughly tested (for obvious reasons…)
-- ###FIXME### QLab and/or the "script runner" is, generally, increasingly unresponsive to scripts the more cues there are in a workspace
-- Declarations
global dialogTitle
set dialogTitle to "All purpose enquiry"
-- The initial pop-up list of parameters (X)
set allPropertiesFromDictionary to {"type", "q number", "q name", "notes", "cue target", "file target", "pre wait", "duration", "post wait", "continue mode", ¬
"armed", "midi trigger", "midi command", "midi byte one", "midi byte two", "timecode trigger", "wall clock trigger", "wall clock hours", "wall clock minutes", ¬
"wall clock seconds", "mode", "sync to timecode", "sync mode", "smpte format", "mtc sync source name", "ltc sync channel", "patch", "start time", "end time", ¬
"loop start time", "loop end time", "loop count", "infinite loop", "guarantee sync", "integrated fade", "fade mode", "stop target when done", "auto stop", "layer", ¬
"full screen", "preserve aspect ratio", "opacity", "translation x", "translation y", "rotation", "scale x", "scale y", "scale locked", "custom rendering", "do opacity", ¬
"do translation", "do rotation", "do scale", "command", "channel", "byte one", "byte two", "byte combo", "end value", "fade", "command format", ¬
"command number", "q_number", "q_list", "q_path", "macro", "control number", "control value", "hours", "minutes", "seconds", "frames", "subframes", ¬
"send time with set", "sysex message", "midi destination", "start time offset", "fire next cue when loop ends", "stop target when loop ends", "load time", ¬
"assigned number", "unique ID", "broken", "audio input channels", "start value"}
set allPropertiesInEnglish to {"type", "number", "name", "notes", "cue target", "file target", "pre wait", "duration", "post wait", "continue mode", ¬
"armed", "triggers: midi on/off [also returns the MIDI data if on]", "triggers: midi command [also returns the MIDI data]", "triggers: midi byte one", ¬
"triggers: midi byte two", "triggers: timecode on/off", "triggers: wall clock on/off [also returns the wall clock time if on]", "triggers: wall clock hours", ¬
"triggers: wall clock minutes", "triggers: wall clock seconds", "mode", "sync to timecode", "sync mode", "smpte format", "mtc sync source name", ¬
"ltc sync channel", "patch", "start time", "end time", "loop start time", "loop end time", "loop count", "infinite loop", "guarantee sync", "integrated fade", ¬
"fade mode", "stop target when done", "auto stop", "layer", "full screen", "preserve aspect ratio", "opacity", "translation x", "translation y", "rotation", ¬
"scale x", "scale y", "scale locked", "custom rendering", "do opacity", "do translation", "do rotation", "do scale", "midi: command [also returns the MIDI data]", ¬
"midi: channel", "midi: byte one", "midi: byte two", "midi: byte combo", "midi: end value", "midi: fade", "msc: command format", "msc: command number", ¬
"msc: q_number", "msc: q_list", "msc: q_path", "msc: macro", "msc: control number", "msc: control value", "msc: hours", "msc: minutes", "msc: seconds", ¬
"msc: frames", "msc: subframes", "msc: send time with set", "sysex message", "midi destination", "start time offset", "fire next cue when loop ends", ¬
"stop target when loop ends", "load time", "assigned number", "unique ID", "broken", "audio input channels", ¬
"midi: start value"} -- The AppleScript commands seem a little abstract otherwise
set allPropertiesAlphabetical to my simple_sort(allPropertiesInEnglish) -- Display the list alphabetically
(* (this script is derived from two others, so it makes sense to keep the AppleScript dictionary order internally) *)
-- Indexes for what further options to offer following initial choice of parameter
set indexTextContains to {"q number", "q name", "notes", "mtc sync source name", "sysex message", ¬
"midi destination", "assigned number"} -- Text it makes sense to search within; the script can also be queried to return all non-blank "notes"
set indexTextIs to {"q_number", "q_list", "q_path"} -- Text it doesn't make sense to search within!
set indexTimess to {"pre wait", "duration", "post wait"} -- Times that are displayed to 0.01s
set indexTimesss to {"start time", "end time", "loop start time", "loop end time", "start time offset", "load time"} -- Times that are displayed to 0.001s
set indexBoolean to {"armed", "infinite loop", "guarantee sync", "stop target when done", "auto stop", "full screen", "preserve aspect ratio", ¬
"scale locked", "custom rendering", "do opacity", "do translation", "do rotation", "do scale", "send time with set", "fire next cue when loop ends", ¬
"stop target when loop ends", "broken"}
set indexEnabled to {"midi trigger", "timecode trigger", "wall clock trigger", "sync to timecode", "integrated fade", "fade"}
set indexIntegerRange to {"midi byte one", "midi byte two", "wall clock hours", "wall clock minutes", "wall clock seconds", "loop count", "layer", ¬
"byte one", "byte two", "byte combo", "end value", "hours", "minutes", "seconds", "frames", "subframes", ¬
"unique ID", "start value"} -- Integers for which it is more useful to search for a range rather than a specific value
set indexIntegerIs to {"ltc sync channel", "patch", "channel", "macro", "control number", "control value", "audio input channels"}
set indexRealRange to {"opacity", "translation x", "translation y", "rotation", "scale x", "scale y"}
-- Possible values for the parameters (Y)
set valuesTime to {"less than", "within 1s of", "greater than", "in the range"}
set valuesBoolean to {"true", "false "} -- The last is a kludge to get round a limitation of "choose from list" (ie: "Cancel" returns "false"!)
set valuesEnabled to {"enabled", "disabled"}
set valuesIntegerRange to {"less than", "equal to", "greater than", "in the range"}
set valuesRealRange to {"less than", "equal to", "greater than", "in the range"}
set values1_q_type_DictionaryOrder to {"Cue List", "Group", "Audio", "Fade", "Video", "Animation", "Camera", "MIDI", "MSC", "MIDI SysEx", "MTC", ¬
"Start", "Stop", "Pause", "Reset", "Devamp", "Load", "Script", "Goto", "Target", "Wait", "Memo", "Arm", "Disarm", "SoundMan"}
set values1_q_type_Expanded to {"Cue List", "Group", "Audio [also returns the file target]", "Fade", "Video [also returns the file target]", "Animation", ¬
"Camera", "MIDI [also returns the MIDI data]", "MSC [also returns the MSC data]", "MIDI SysEx [also returns the SysEx messages]", "MTC", ¬
"Start", "Stop", "Pause", "Reset", "Devamp", "Load", "Script", "Goto", "Target", "Wait", "Memo", "Arm", "Disarm", "SoundMan"}
set values1_q_type to my simple_sort(values1_q_type_Expanded)
-- values2_q_number: text
-- values3_q_name: text
-- values4_notes: text
-- values5_cue_target: cue; NB: this makes searching tricky, as you have to have a unique way of defining the cue you are searching for (eg: q number)
-- values6_file_target: file
-- values7_pre_wait: real (time)
-- values8_duration: real (time); NB: MIDI cues always have a duration, even though it's only actually shown in the Action column if "Fade to Control Value" is on
-- values9_post_wait: real (time)
set values10_continue_mode to {"do_not_continue", "auto_continue", "auto_follow"}
-- values11_armed: boolean
-- values12_midi_trigger: enabled/disabled
set values13_midi_command to {"note_on", "note_off", "program_change", "control_change", "key_pressure", "channel_pressure"}
-- values14_midi_byte_one: integer
-- values15_midi_byte_two: integer
-- values16_timecode_trigger: enabled/disabled
-- values17_wall_clock_trigger: enabled/disabled
-- values18_wall_clock_hours: integer; NB: reported as 24-hour, although displayed as am/pm
-- values19_wall_clock_minutes: integer
-- values20_wall_clock_seconds: integer
set values21_mode to {"cue_list", "fire_first_enter_group", "fire_first_go_to_next_cue", "fire_all", "fire_random"}
-- values22_sync_to_timecode: enabled/disabled
set values23_sync_mode to {"mtc", "ltc"}
set values24_smpte_format to {"fps_24", "fps_25", "fps_30_drop", "fps_30_non_drop"}
-- values25_mtc_sync_source_name: text
-- values26_ltc_sync_channel: integer
-- values27_patch: integer
-- values28_start_time: real (time)
-- values29_end_time: real (time)
-- values30_loop_start_time: real (time)
-- values31_loop_end_time: real (time)
-- values32_loop_count: integer
-- values33_infinite_loop: boolean
-- values34_guarantee_sync: boolean
-- values35_integrated_fade: enabled/disabled
set values36_fade_mode to {"absolute", "relative"}
-- values37_stop_target_when_done: boolean
-- values38_auto_stop: boolean
-- values39_layer: integer
-- values40_full_screen: boolean
-- values41_preserve_aspect_ratio: boolean
-- values42_opacity: real; NB: reported as 0 to 1, although displayed as %
-- values43_translation_x: real
-- values44_translation_y : real
-- values45_rotation: real
-- values46_scale_x: real
-- values47_scale_y: real
-- values48_scale_locked: boolean
-- values49_custom_rendering: boolean
-- values50_do_opacity: boolean
-- values51_do_translation: boolean
-- values52_do_rotation: boolean
-- values53_do_scale: boolean
set values54_command to {"note_on", "note_off", "program_change", "control_change", "key_pressure", "channel_pressure", "pitch_bend"}
-- values55_channel: integer
-- values56_byte_one: integer
-- values57_byte_two: integer
-- values58_byte_combo: integer
-- values59_end_value: integer
-- values60_fade: enabled/disabled
set values61_command_format to {"Lighting (General)", "Moving Lights", "Color Changers", "Strobes", "Lasers", "Chasers", ¬
"Sound (General)", "Music", "CD Players", "EPROM Playback", "Audio Tape Machines", "Intercoms", "Amplifiers", "Audio Effects Devices", "Equalizers", ¬
"Machinery (General)", "Rigging", "Flys", "Lifts", "Turntables", "Trusses", "Robots", "Animation", "Floats", "Breakaways", "Barges", ¬
"Video (General)", "Video Tape Machines", "Video Cassette Machines", "Video Disc Players", "Video Switchers", "Video Effects", ¬
"Video Character Generators", "Video Still Stores", "Video Monitors", "Projection (General)", "Film Projectors", "Slide Projectors", "Video Projectors", ¬
"Dissolvers", "Shutter Controls", "Process Control (General)", "Hydraulic Oil", "H2O", "CO2", "Compressed Air", "Natural Gas", "Fog", "Smoke", ¬
"Cracked Haze", "Pyrotechnics (General)", "Fireworks", "Explosions", "Flame", "Smoke Pots", "All Types"}
set values62_command_number to {"GO", "STOP", "RESUME", "TIMED_GO", "LOAD", "SET", "FIRE", "ALL_OFF", "RESTORE", "RESET", "GO_OFF", ¬
"GO/JAM_CLOCK", "STANDBY_+", "STANDBY_-", "SEQUENCE_+", "SEQUENCE_-", "START_CLOCK", "STOP_CLOCK", "ZERO_CLOCK", "SET_CLOCK", ¬
"MTC_CHASE_ON", "MTC_CHASE_OFF", "OPEN_CUE_LIST", "CLOSE_CUE_LIST", "OPEN_CUE_PATH", "CLOSE_CUE_PATH"}
-- values63_q__number: text (number)
-- values64_q__list: text (number)
-- values65_q__path: text (number)
-- values66_macro: integer
-- values67_control_number: integer
-- values68_control_value: integer
-- values69_hours: integer
-- values70_minutes: integer
-- values71_seconds: integer
-- values72_frames: integer
-- values73_subframes: integer
-- values74_send_time_with_set : boolean
-- values75_sysex_message: text
-- values76_midi_destination: text
-- values77_start_time_offset: real (time)
-- values78_fire_next_cue_when_loop_ends: boolean
-- values79_stop_target_when_loop_ends: boolean
-- values80_load_time: real (time)
-- values81_assigned_number: text
-- values82: there is no 82 in this script ("is in group" from "Make a text file from cues")
-- values83_unique ID: text (actually an integer)
-- values84_broken: boolean
-- values85_audio_input_channels: integer
-- values86_start_value: integer
-- These variables are used to translate MSC integers into English
set translation61_command_format to {"1", "Lighting (General)", "2", "Moving Lights", "3", "Color Changers", "4", "Strobes", "5", "Lasers", "6", "Chasers", ¬
"16", "Sound (General)", "17", "Music", "18", "CD Players", "19", "EPROM Playback", "20", "Audio Tape Machines", "21", "Intercoms", "22", "Amplifiers", ¬
"23", "Audio Effects Devices", "24", "Equalizers", "32", "Machinery (General)", "33", "Rigging", "34", "Flys", "35", "Lifts", "36", "Turntables", "37", "Trusses", ¬
"38", "Robots", "39", "Animation", "40", "Floats", "41", "Breakaways", "42", "Barges", "48", "Video (General)", "49", "Video Tape Machines", ¬
"50", "Video Cassette Machines", "51", "Video Disc Players", "52", "Video Switchers", "53", "Video Effects", "54", "Video Character Generators", ¬
"55", "Video Still Stores", "56", "Video Monitors", "64", "Projection (General)", "65", "Film Projectors", "66", "Slide Projectors", "67", "Video Projectors", ¬
"68", "Dissolvers", "69", "Shutter Controls", "80", "Process Control (General)", "81", "Hydraulic Oil", "82", "H2O", "83", "CO2", "84", "Compressed Air", ¬
"85", "Natural Gas", "86", "Fog", "87", "Smoke", "88", "Cracked Haze", "96", "Pyrotechnics (General)", "97", "Fireworks", "98", "Explosions", "99", "Flame", ¬
"100", "Smoke Pots", "127", "All Types"}
set translation62_command_number to {"1", "GO", "2", "STOP", "3", "RESUME", "4", "TIMED_GO", "5", "LOAD", "6", "SET", "7", "FIRE", "8", "ALL_OFF", ¬
"9", "RESTORE", "10", "RESET", "11", "GO_OFF", "16", "GO/JAM_CLOCK", "17", "STANDBY_+", "18", "STANDBY_-", "19", "SEQUENCE_+", ¬
"20", "SEQUENCE_-", "21", "START_CLOCK", "22", "STOP_CLOCK", "23", "ZERO_CLOCK", "24", "SET_CLOCK", "25", "MTC_CHASE_ON", ¬
"26", "MTC_CHASE_OFF", "27", "OPEN_CUE_LIST", "28", "CLOSE_CUE_LIST", "29", "OPEN_CUE_PATH", "30", "CLOSE_CUE_PATH"}
-- General variables
global startTime, ohDear, abortAbort, subChoiceArmed, subChoiceContinueMode, subChoiceMode, subChoiceGuaranteeSync
set foundIDs to {}
set foundNumbers to {}
set foundNames to {}
set foundProperties to {}
set theVerb to "is"
set carriageReturnsInNotes to "¶" -- Have to remove carriage returns from notes text as they would corrupt the tab-delimited structure
set whatNextChoices to {"Copy to Clipboard", "Open in TextEdit", "Batch adjust", "Step through cues (not cue lists)"}
set processChoices to {"Levels", "File target", "File target (keeping times)", "Name", "Notes", "Times", "MIDI", "Armed", "Continue mode", ¬
"Guarantee sync", "Mode", "Finished adjusting"}
set subChoiceName to {"Set", "Reset to file target", "Basic search & replace", "Add prefix", "Add suffix", "Make series"}
set subChoiceNotes to {"Clear", "Set", "Basic search & replace", "Add prefix", "Add suffix"}
set subChoiceTimesParameter to {"pre wait", "duration", "post wait"}
set subChoiceTimes to {"Set", "Scale", "Add/subtract amount"}
set subChoiceMIDIParameter to {"channel", "byte one", "byte two", "byte combo", "end value"}
set subChoiceMIDI to {"Set", "Scale", "Add/subtract amount", "Make series"}
set subChoiceArmed to {"true", "false "} -- These values can be customised as they are never used explicitly (note "false " kludge for pick from list)
set subChoiceContinueMode to {"do_not_continue", "auto_continue", "auto_follow"} -- These values can be customised as they are never used explicitly
set subChoiceGuaranteeSync to {"true", "false "} -- These values can be customised as they are never used explicitly (note "false " kludge for pick from list)
set subChoiceMode to {"fire_first_enter_group", "fire_first_go_to_next_cue", "fire_all", ¬
"fire_random"} -- These values can be customised as they are never used explicitly
-- Preamble
display dialog theExplanation with title dialogTitle with icon 1 buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel"
-- Grab the current time and format it appropriately to append it to the filename (including seconds as this script might be run several times in short succession)
set theTime to my grabCurrentTimeYYMMDDHHMMSS()
-- Check QLab is running
tell application "System Events"
set qLabIsRunning to count (every process whose name is "QLab")
end tell
if qLabIsRunning is 0 then
display dialog "QLab is not running." with title dialogTitle with icon 0 buttons {"OK"} default button "OK" giving up after 5
return
end if
tell application "QLab"
activate
-- Get the workspace name for later, and also protect against no open workspace
try
set workspaceName to q number of front workspace -- This actually gets the name of the workspace
on error
display dialog "There is no workspace open in QLab." with title dialogTitle with icon 0 buttons {"OK"} default button "OK" giving up after 5
return
end try
tell front workspace
-- Specify the enquiry
set whoseProperty to my pickFromList(allPropertiesAlphabetical, "Find all cues whose...")
set whosePropertyHeader to whoseProperty -- This will be used in the header row of text reports
-- Translate back (whoseProperty will now be presented to the user in AppleScript rather than in English!)
repeat with i from 1 to count allPropertiesInEnglish
if whoseProperty is item i of allPropertiesInEnglish then
set whoseProperty to item i of allPropertiesFromDictionary
exit repeat
end if
end repeat
-- Get results for "text contains"
if whoseProperty is in indexTextContains then
set theVerb to "contains"
if whoseProperty is not "notes" then
set hasValue to my enterSomeText("Find all cues whose \"" & whoseProperty & "\" contains:", "")
else
set hasValue to text returned of (display dialog "Find all cues whose \"" & whoseProperty ¬
& "\" contains (or you can enter nothing to return all non-blanks):" with title dialogTitle ¬
default answer "" buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")
end if
my startTheClock()
if whoseProperty is "q number" then
set foundIDs to uniqueID of cues whose q number contains hasValue
set foundNumbers to q number of cues whose q number contains hasValue
set foundNames to q name of cues whose q number contains hasValue
else if whoseProperty is "q name" then
set foundIDs to uniqueID of cues whose q name contains hasValue
set foundNumbers to q number of cues whose q name contains hasValue
set foundNames to q name of cues whose q name contains hasValue
else if whoseProperty is "notes" then
if hasValue is not "" then
set foundIDs to uniqueID of cues whose notes contains hasValue
set foundNumbers to q number of cues whose notes contains hasValue
set foundNames to q name of cues whose notes contains hasValue
set foundProperties to notes of cues whose notes contains hasValue
else
set theVerb to "is"
set hasValue to "non-blank"
set allIDs to uniqueID of cues
set allNumbers to q number of cues
set allNames to q name of cues
set allNotes to notes of cues
repeat with i from 1 to count allIDs
set eachNote to (item i of allNotes) as string
if eachNote is not "missing value" and eachNote is not "" then
copy (item i of allIDs) as string to end of foundIDs
copy (item i of allNumbers) as string to end of foundNumbers
copy (item i of allNames) as string to end of foundNames
copy eachNote to end of foundProperties
end if
end repeat
end if
else if whoseProperty is "mtc sync source name" then
set foundIDs to uniqueID of cues whose mtc sync source name contains hasValue
set foundNumbers to q number of cues whose mtc sync source name contains hasValue
set foundNames to q name of cues whose mtc sync source name contains hasValue
set foundProperties to mtc sync source name of cues whose mtc sync source name contains hasValue
else if whoseProperty is "sysex message" then
set foundIDs to uniqueID of cues whose sysex message contains hasValue
set foundNumbers to q number of cues whose sysex message contains hasValue
set foundNames to q name of cues whose sysex message contains hasValue
set foundProperties to sysex message of cues whose sysex message contains hasValue
else if whoseProperty is "midi destination" then
set foundIDs to uniqueID of cues whose midi destination contains hasValue
set foundNumbers to q number of cues whose midi destination contains hasValue
set foundNames to q name of cues whose midi destination contains hasValue
set foundProperties to midi destination of cues whose midi destination contains hasValue
else if whoseProperty is "assigned number" then
set foundIDs to uniqueID of cues whose assigned number is hasValue
set foundNumbers to q number of cues whose assigned number is hasValue
set foundNames to q name of cues whose assigned number is hasValue
set foundProperties to assigned number of cues whose assigned number is hasValue
end if
end if
-- Get results for "text is"
if whoseProperty is in indexTextIs then
set hasValue to my enterSomeText("Find all cues whose \"" & whoseProperty & "\" is:", "")
my startTheClock()
if whoseProperty is "q_number" then
set foundIDs to uniqueID of cues whose q_number is hasValue
set foundNumbers to q number of cues whose q_number is hasValue
set foundNames to q name of cues whose q_number is hasValue
else if whoseProperty is "q_list" then
set foundIDs to uniqueID of cues whose q_list is hasValue
set foundNumbers to q number of cues whose q_list is hasValue
set foundNames to q name of cues whose q_list is hasValue
else if whoseProperty is "q_path" then
set foundIDs to uniqueID of cues whose q_path is hasValue
set foundNumbers to q number of cues whose q_path is hasValue
set foundNames to q name of cues whose q_path is hasValue
end if
end if
-- Get results for "time"
if whoseProperty is in (indexTimess & indexTimesss) then
set theQualifier to my pickFromList(valuesTime, "Find all cues whose \"" & whoseProperty & "\" is:")
set theVerb to "is " & theQualifier
if theQualifier is not "in the range" then
set hasValue to my enterATimeWithCustomButton("Find all cues whose \"" & whoseProperty ¬
& "\" " & theVerb & " (seconds or minutes:seconds):", "", {})
else
set lowerRange to my enterATimeWithCustomButton("Enter the lower end of the range (seconds or minutes:seconds):", "", {})
set hasValue to my enterATimeWithCustomButton("Enter the upper end of the range (seconds or minutes:seconds):", "", {})
end if
my startTheClock()
if whoseProperty is "pre wait" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose pre wait < hasValue
set foundNumbers to q number of cues whose pre wait < hasValue
set foundNames to q name of cues whose pre wait < hasValue
set foundProperties to pre wait of cues whose pre wait < hasValue
else if theQualifier is "within 1s of" then
set foundIDs to uniqueID of cues whose (pre wait ≥ (hasValue - 1) and pre wait ≤ (hasValue + 1))
set foundNumbers to q number of cues whose (pre wait ≥ (hasValue - 1) and pre wait ≤ (hasValue + 1))
set foundNames to q name of cues whose (pre wait ≥ (hasValue - 1) and pre wait ≤ (hasValue + 1))
set foundProperties to pre wait of cues whose (pre wait ≥ (hasValue - 1) and pre wait ≤ (hasValue + 1))
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose pre wait > hasValue
set foundNumbers to q number of cues whose pre wait > hasValue
set foundNames to q name of cues whose pre wait > hasValue
set foundProperties to pre wait of cues whose pre wait > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (pre wait ≥ lowerRange and pre wait ≤ hasValue)
set foundNumbers to q number of cues whose (pre wait ≥ lowerRange and pre wait ≤ hasValue)
set foundNames to q name of cues whose (pre wait ≥ lowerRange and pre wait ≤ hasValue)
set foundProperties to pre wait of cues whose (pre wait ≥ lowerRange and pre wait ≤ hasValue)
end if
else if whoseProperty is "duration" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose duration < hasValue
set foundNumbers to q number of cues whose duration < hasValue
set foundNames to q name of cues whose duration < hasValue
set foundProperties to duration of cues whose duration < hasValue
else if theQualifier is "within 1s of" then
set foundIDs to uniqueID of cues whose (duration ≥ (hasValue - 1) and duration ≤ (hasValue + 1))
set foundNumbers to q number of cues whose (duration ≥ (hasValue - 1) and duration ≤ (hasValue + 1))
set foundNames to q name of cues whose (duration ≥ (hasValue - 1) and duration ≤ (hasValue + 1))
set foundProperties to duration of cues whose (duration ≥ (hasValue - 1) and duration ≤ (hasValue + 1))
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose duration > hasValue
set foundNumbers to q number of cues whose duration > hasValue
set foundNames to q name of cues whose duration > hasValue
set foundProperties to duration of cues whose duration > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (duration ≥ lowerRange and duration ≤ hasValue)
set foundNumbers to q number of cues whose (duration ≥ lowerRange and duration ≤ hasValue)
set foundNames to q name of cues whose (duration ≥ lowerRange and duration ≤ hasValue)
set foundProperties to duration of cues whose (duration ≥ lowerRange and duration ≤ hasValue)
end if
else if whoseProperty is "post wait" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose post wait < hasValue
set foundNumbers to q number of cues whose post wait < hasValue
set foundNames to q name of cues whose post wait < hasValue
set foundProperties to post wait of cues whose post wait < hasValue
else if theQualifier is "within 1s of" then
set foundIDs to uniqueID of cues whose (post wait ≥ (hasValue - 1) and post wait ≤ (hasValue + 1))
set foundNumbers to q number of cues whose (post wait ≥ (hasValue - 1) and post wait ≤ (hasValue + 1))
set foundNames to q name of cues whose (post wait ≥ (hasValue - 1) and post wait ≤ (hasValue + 1))
set foundProperties to post wait of cues whose (post wait ≥ (hasValue - 1) and post wait ≤ (hasValue + 1))
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose post wait > hasValue
set foundNumbers to q number of cues whose post wait > hasValue
set foundNames to q name of cues whose post wait > hasValue
set foundProperties to post wait of cues whose post wait > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (post wait ≥ lowerRange and post wait ≤ hasValue)
set foundNumbers to q number of cues whose (post wait ≥ lowerRange and post wait ≤ hasValue)
set foundNames to q name of cues whose (post wait ≥ lowerRange and post wait ≤ hasValue)
set foundProperties to post wait of cues whose (post wait ≥ lowerRange and post wait ≤ hasValue)
end if
else if whoseProperty is "start time" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose start time < hasValue
set foundNumbers to q number of cues whose start time < hasValue
set foundNames to q name of cues whose start time < hasValue
set foundProperties to start time of cues whose start time < hasValue
else if theQualifier is "within 1s of" then
set foundIDs to uniqueID of cues whose (start time ≥ (hasValue - 1) and start time ≤ (hasValue + 1))
set foundNumbers to q number of cues whose (start time ≥ (hasValue - 1) and start time ≤ (hasValue + 1))
set foundNames to q name of cues whose (start time ≥ (hasValue - 1) and start time ≤ (hasValue + 1))
set foundProperties to start time of cues whose (start time ≥ (hasValue - 1) and start time ≤ (hasValue + 1))
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose start time > hasValue
set foundNumbers to q number of cues whose start time > hasValue
set foundNames to q name of cues whose start time > hasValue
set foundProperties to start time of cues whose start time > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (start time ≥ lowerRange and start time ≤ hasValue)
set foundNumbers to q number of cues whose (start time ≥ lowerRange and start time ≤ hasValue)
set foundNames to q name of cues whose (start time ≥ lowerRange and start time ≤ hasValue)
set foundProperties to start time of cues whose (start time ≥ lowerRange and start time ≤ hasValue)
end if
else if whoseProperty is "end time" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose end time < hasValue
set foundNumbers to q number of cues whose end time < hasValue
set foundNames to q name of cues whose end time < hasValue
set foundProperties to end time of cues whose end time < hasValue
else if theQualifier is "within 1s of" then
set foundIDs to uniqueID of cues whose (end time ≥ (hasValue - 1) and end time ≤ (hasValue + 1))
set foundNumbers to q number of cues whose (end time ≥ (hasValue - 1) and end time ≤ (hasValue + 1))
set foundNames to q name of cues whose (end time ≥ (hasValue - 1) and end time ≤ (hasValue + 1))
set foundProperties to end time of cues whose (end time ≥ (hasValue - 1) and end time ≤ (hasValue + 1))
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose end time > hasValue
set foundNumbers to q number of cues whose end time > hasValue
set foundNames to q name of cues whose end time > hasValue
set foundProperties to end time of cues whose end time > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (end time ≥ lowerRange and end time ≤ hasValue)
set foundNumbers to q number of cues whose (end time ≥ lowerRange and end time ≤ hasValue)
set foundNames to q name of cues whose (end time ≥ lowerRange and end time ≤ hasValue)
set foundProperties to end time of cues whose (end time ≥ lowerRange and end time ≤ hasValue)
end if
else if whoseProperty is "loop start time" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose loop start time < hasValue
set foundNumbers to q number of cues whose loop start time < hasValue
set foundNames to q name of cues whose loop start time < hasValue
set foundProperties to loop start time of cues whose loop start time < hasValue
else if theQualifier is "within 1s of" then
set foundIDs to uniqueID of cues whose (loop start time ≥ (hasValue - 1) and loop start time ≤ (hasValue + 1))
set foundNumbers to q number of cues whose (loop start time ≥ (hasValue - 1) and loop start time ≤ (hasValue + 1))
set foundNames to q name of cues whose (loop start time ≥ (hasValue - 1) and loop start time ≤ (hasValue + 1))
set foundProperties to loop start time of cues whose (loop start time ≥ (hasValue - 1) and loop start time ≤ (hasValue + 1))
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose loop start time > hasValue
set foundNumbers to q number of cues whose loop start time > hasValue
set foundNames to q name of cues whose loop start time > hasValue
set foundProperties to loop start time of cues whose loop start time > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (loop start time ≥ lowerRange and loop start time ≤ hasValue)
set foundNumbers to q number of cues whose (loop start time ≥ lowerRange and loop start time ≤ hasValue)
set foundNames to q name of cues whose (loop start time ≥ lowerRange and loop start time ≤ hasValue)
set foundProperties to loop start time of cues whose (loop start time ≥ lowerRange and loop start time ≤ hasValue)
end if
else if whoseProperty is "loop end time" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose loop end time < hasValue
set foundNumbers to q number of cues whose loop end time < hasValue
set foundNames to q name of cues whose loop end time < hasValue
set foundProperties to loop end time of cues whose loop end time < hasValue
else if theQualifier is "within 1s of" then
set foundIDs to uniqueID of cues whose (loop end time ≥ (hasValue - 1) and loop end time ≤ (hasValue + 1))
set foundNumbers to q number of cues whose (loop end time ≥ (hasValue - 1) and loop end time ≤ (hasValue + 1))
set foundNames to q name of cues whose (loop end time ≥ (hasValue - 1) and loop end time ≤ (hasValue + 1))
set foundProperties to loop end time of cues whose (loop end time ≥ (hasValue - 1) and loop end time ≤ (hasValue + 1))
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose loop end time > hasValue
set foundNumbers to q number of cues whose loop end time > hasValue
set foundNames to q name of cues whose loop end time > hasValue
set foundProperties to loop end time of cues whose loop end time > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (loop end time ≥ lowerRange and loop end time ≤ hasValue)
set foundNumbers to q number of cues whose (loop end time ≥ lowerRange and loop end time ≤ hasValue)
set foundNames to q name of cues whose (loop end time ≥ lowerRange and loop end time ≤ hasValue)
set foundProperties to loop end time of cues whose (loop end time ≥ lowerRange and loop end time ≤ hasValue)
end if
else if whoseProperty is "start time offset" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose start time offset < hasValue
set foundNumbers to q number of cues whose start time offset < hasValue
set foundNames to q name of cues whose start time offset < hasValue
set foundProperties to start time offset of cues whose start time offset < hasValue
else if theQualifier is "within 1s of" then
set foundIDs to uniqueID of cues whose (start time offset ≥ (hasValue - 1) and start time offset ≤ (hasValue + 1))
set foundNumbers to q number of cues whose (start time offset ≥ (hasValue - 1) and start time offset ≤ (hasValue + 1))
set foundNames to q name of cues whose (start time offset ≥ (hasValue - 1) and start time offset ≤ (hasValue + 1))
set foundProperties to start time offset of cues whose (start time offset ≥ (hasValue - 1) and start time offset ≤ (hasValue + 1))
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose start time offset > hasValue
set foundNumbers to q number of cues whose start time offset > hasValue
set foundNames to q name of cues whose start time offset > hasValue
set foundProperties to start time offset of cues whose start time offset > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (start time offset ≥ lowerRange and start time offset ≤ hasValue)
set foundNumbers to q number of cues whose (start time offset ≥ lowerRange and start time offset ≤ hasValue)
set foundNames to q name of cues whose (start time offset ≥ lowerRange and start time offset ≤ hasValue)
set foundProperties to start time offset of cues whose (start time offset ≥ lowerRange and start time offset ≤ hasValue)
end if
else if whoseProperty is "load time" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose load time < hasValue
set foundNumbers to q number of cues whose load time < hasValue
set foundNames to q name of cues whose load time < hasValue
set foundProperties to load time of cues whose load time < hasValue
else if theQualifier is "within 1s of" then
set foundIDs to uniqueID of cues whose (load time ≥ (hasValue - 1) and load time ≤ (hasValue + 1))
set foundNumbers to q number of cues whose (load time ≥ (hasValue - 1) and load time ≤ (hasValue + 1))
set foundNames to q name of cues whose (load time ≥ (hasValue - 1) and load time ≤ (hasValue + 1))
set foundProperties to load time of cues whose (load time ≥ (hasValue - 1) and load time ≤ (hasValue + 1))
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose load time > hasValue
set foundNumbers to q number of cues whose load time > hasValue
set foundNames to q name of cues whose load time > hasValue
set foundProperties to load time of cues whose load time > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (load time ≥ lowerRange and load time ≤ hasValue)
set foundNumbers to q number of cues whose (load time ≥ lowerRange and load time ≤ hasValue)
set foundNames to q name of cues whose (load time ≥ lowerRange and load time ≤ hasValue)
set foundProperties to load time of cues whose (load time ≥ lowerRange and load time ≤ hasValue)
end if
end if
if whoseProperty is in indexTimess then
set hasValue to my makeHHMMSSss(hasValue)
if theQualifier is "in the range" then
set theVerb to theVerb & " from \"" & my makeHHMMSSss(lowerRange) & "\" to"
end if
else
set hasValue to my makeHHMMSSsss(hasValue)
if theQualifier is "in the range" then
set theVerb to theVerb & " from \"" & my makeHHMMSSsss(lowerRange) & "\" to"
end if
end if
end if
-- Get results for "boolean"
if whoseProperty is in indexBoolean then
set hasValue to my pickFromList(valuesBoolean, "Find all cues whose \"" & whoseProperty & "\" is:")
if hasValue is "false " then
set hasValue to "false"
end if
my startTheClock()
if whoseProperty is "armed" then
set foundIDs to uniqueID of cues whose armed is hasValue
set foundNumbers to q number of cues whose armed is hasValue
set foundNames to q name of cues whose armed is hasValue
else if whoseProperty is "infinite loop" then
set foundIDs to uniqueID of cues whose infinite loop is hasValue
set foundNumbers to q number of cues whose infinite loop is hasValue
set foundNames to q name of cues whose infinite loop is hasValue
else if whoseProperty is "guarantee sync" then
set foundIDs to uniqueID of cues whose guarantee sync is hasValue
set foundNumbers to q number of cues whose guarantee sync is hasValue
set foundNames to q name of cues whose guarantee sync is hasValue
else if whoseProperty is "stop target when done" then
set foundIDs to uniqueID of cues whose stop target when done is hasValue
set foundNumbers to q number of cues whose stop target when done is hasValue
set foundNames to q name of cues whose stop target when done is hasValue
else if whoseProperty is "auto stop" then
set foundIDs to uniqueID of cues whose auto stop is hasValue
set foundNumbers to q number of cues whose auto stop is hasValue
set foundNames to q name of cues whose auto stop is hasValue
else if whoseProperty is "full screen" then
set foundIDs to uniqueID of cues whose full screen is hasValue
set foundNumbers to q number of cues whose full screen is hasValue
set foundNames to q name of cues whose full screen is hasValue
else if whoseProperty is "preserve aspect ratio" then
set foundIDs to uniqueID of cues whose preserve aspect ratio is hasValue
set foundNumbers to q number of cues whose preserve aspect ratio is hasValue
set foundNames to q name of cues whose preserve aspect ratio is hasValue
else if whoseProperty is "scale locked" then
set foundIDs to uniqueID of cues whose scale locked is hasValue
set foundNumbers to q number of cues whose scale locked is hasValue
set foundNames to q name of cues whose scale locked is hasValue
else if whoseProperty is "custom rendering" then
set foundIDs to uniqueID of cues whose custom rendering is hasValue
set foundNumbers to q number of cues whose custom rendering is hasValue
set foundNames to q name of cues whose custom rendering is hasValue
else if whoseProperty is "do opacity" then
set foundIDs to uniqueID of cues whose do opacity is hasValue
set foundNumbers to q number of cues whose do opacity is hasValue
set foundNames to q name of cues whose do opacity is hasValue
else if whoseProperty is "do translation" then
set foundIDs to uniqueID of cues whose do translation is hasValue
set foundNumbers to q number of cues whose do translation is hasValue
set foundNames to q name of cues whose do translation is hasValue
else if whoseProperty is "do rotation" then
set foundIDs to uniqueID of cues whose do rotation is hasValue
set foundNumbers to q number of cues whose do rotation is hasValue
set foundNames to q name of cues whose do rotation is hasValue
else if whoseProperty is "do scale" then
set foundIDs to uniqueID of cues whose do scale is hasValue
set foundNumbers to q number of cues whose do scale is hasValue
set foundNames to q name of cues whose do scale is hasValue
else if whoseProperty is "send time with set" then
set foundIDs to uniqueID of cues whose send time with set is hasValue
set foundNumbers to q number of cues whose send time with set is hasValue
set foundNames to q name of cues whose send time with set is hasValue
else if whoseProperty is "fire next cue when loop ends" then
set foundIDs to uniqueID of cues whose fire next cue when loop ends is hasValue
set foundNumbers to q number of cues whose fire next cue when loop ends is hasValue
set foundNames to q name of cues whose fire next cue when loop ends is hasValue
else if whoseProperty is "stop target when loop ends" then
set foundIDs to uniqueID of cues whose stop target when loop ends is hasValue
set foundNumbers to q number of cues whose stop target when loop ends is hasValue
set foundNames to q name of cues whose stop target when loop ends is hasValue
else if whoseProperty is "broken" then
set foundIDs to uniqueID of cues whose broken is hasValue
set foundNumbers to q number of cues whose broken is hasValue
set foundNames to q name of cues whose broken is hasValue
end if
end if
-- Get results for "enabled/disabled"
if whoseProperty is in indexEnabled then
set hasValue to my pickFromList(valuesEnabled, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
if whoseProperty is "midi trigger" then -- Additional reporting
if hasValue is "enabled" then
set foundIDs to uniqueID of cues whose midi trigger is enabled
set foundNumbers to q number of cues whose midi trigger is enabled
set foundNames to q name of cues whose midi trigger is enabled
set whosePropertyHeader to "midi byte one" & tab & "midi byte two"
set foundProperties1 to midi byte one of cues whose midi trigger is enabled
set foundProperties2 to midi byte two of cues whose midi trigger is enabled
repeat with i from 1 to count foundProperties1
copy (((item i of foundProperties1) as string) & tab & (item i of foundProperties2) as string) to end of foundProperties
end repeat
else if hasValue is "disabled" then
set foundIDs to uniqueID of cues whose midi trigger is disabled
set foundNumbers to q number of cues whose midi trigger is disabled
set foundNames to q name of cues whose midi trigger is disabled
end if
else if whoseProperty is "timecode trigger" then
if hasValue is "enabled" then
set foundIDs to uniqueID of cues whose timecode trigger is enabled
set foundNumbers to q number of cues whose timecode trigger is enabled
set foundNames to q name of cues whose timecode trigger is enabled
else if hasValue is "disabled" then
set foundIDs to uniqueID of cues whose timecode trigger is disabled
set foundNumbers to q number of cues whose timecode trigger is disabled
set foundNames to q name of cues whose timecode trigger is disabled
end if
else if whoseProperty is "wall clock trigger" then -- Additional reporting
if hasValue is "enabled" then
set foundIDs to uniqueID of cues whose wall clock trigger is enabled
set foundNumbers to q number of cues whose wall clock trigger is enabled
set foundNames to q name of cues whose wall clock trigger is enabled
set whosePropertyHeader to "wall clock trigger time"
set foundProperties1 to wall clock hours of cues whose wall clock trigger is enabled
set foundProperties2 to wall clock minutes of cues whose wall clock trigger is enabled
set foundProperties3 to wall clock seconds of cues whose wall clock trigger is enabled
repeat with i from 1 to count foundProperties1
copy my padWithZeroes((item i of foundProperties1) as string, 2) & ¬
":" & my padWithZeroes((item i of foundProperties2) as string, 2) & ¬
":" & my padWithZeroes((item i of foundProperties3) as string, 2) to end of foundProperties
end repeat
else if hasValue is "disabled" then
set foundIDs to uniqueID of cues whose wall clock trigger is disabled
set foundNumbers to q number of cues whose wall clock trigger is disabled
set foundNames to q name of cues whose wall clock trigger is disabled
end if
else if whoseProperty is "sync to timecode" then
if hasValue is "enabled" then
set foundIDs to uniqueID of cues whose sync to timecode is enabled
set foundNumbers to q number of cues whose sync to timecode is enabled
set foundNames to q name of cues whose sync to timecode is enabled
else if hasValue is "disabled" then
set foundIDs to uniqueID of cues whose sync to timecode is disabled
set foundNumbers to q number of cues whose sync to timecode is disabled
set foundNames to q name of cues whose sync to timecode is disabled
end if
else if whoseProperty is "integrated fade" then
if hasValue is "enabled" then
set foundIDs to uniqueID of cues whose integrated fade is enabled
set foundNumbers to q number of cues whose integrated fade is enabled
set foundNames to q name of cues whose integrated fade is enabled
else if hasValue is "disabled" then
set foundIDs to uniqueID of cues whose integrated fade is disabled
set foundNumbers to q number of cues whose integrated fade is disabled
set foundNames to q name of cues whose integrated fade is disabled
end if
else if whoseProperty is "fade" then
if hasValue is "enabled" then
set foundIDs to uniqueID of cues whose fade is enabled
set foundNumbers to q number of cues whose fade is enabled
set foundNames to q name of cues whose fade is enabled
else if hasValue is "disabled" then
set foundIDs to uniqueID of cues whose fade is disabled
set foundNumbers to q number of cues whose fade is disabled
set foundNames to q name of cues whose fade is disabled
end if
end if
end if
-- Get results for "integer range"
if whoseProperty is in indexIntegerRange then
set theQualifier to my pickFromList(valuesIntegerRange, "Find all cues whose \"" & whoseProperty & "\" is:")
set theVerb to "is " & theQualifier
if theQualifier is not "in the range" then
set hasValue to my enterAnInteger("Find all cues whose \"" & whoseProperty & "\" " & theVerb & ":", "")
else
set lowerRange to my enterAnInteger("Enter the lower end of the range:", "")
set hasValue to my enterAnInteger("Enter the upper end of the range:", "")
end if
my startTheClock()
if whoseProperty is "midi byte one" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose midi byte one < hasValue
set foundNumbers to q number of cues whose midi byte one < hasValue
set foundNames to q name of cues whose midi byte one < hasValue
set foundProperties to midi byte one of cues whose midi byte one < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose midi byte one is hasValue
set foundNumbers to q number of cues whose midi byte one is hasValue
set foundNames to q name of cues whose midi byte one is hasValue
set foundProperties to midi byte one of cues whose midi byte one is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose midi byte one > hasValue
set foundNumbers to q number of cues whose midi byte one > hasValue
set foundNames to q name of cues whose midi byte one > hasValue
set foundProperties to midi byte one of cues whose midi byte one > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (midi byte one ≥ lowerRange and midi byte one ≤ hasValue)
set foundNumbers to q number of cues whose (midi byte one ≥ lowerRange and midi byte one ≤ hasValue)
set foundNames to q name of cues whose (midi byte one ≥ lowerRange and midi byte one ≤ hasValue)
set foundProperties to midi byte one of cues whose (midi byte one ≥ lowerRange and midi byte one ≤ hasValue)
end if
else if whoseProperty is "midi byte two" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose midi byte two < hasValue
set foundNumbers to q number of cues whose midi byte two < hasValue
set foundNames to q name of cues whose midi byte two < hasValue
set foundProperties to midi byte two of cues whose midi byte two < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose midi byte two is hasValue
set foundNumbers to q number of cues whose midi byte two is hasValue
set foundNames to q name of cues whose midi byte two is hasValue
set foundProperties to midi byte two of cues whose midi byte two is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose midi byte two > hasValue
set foundNumbers to q number of cues whose midi byte two > hasValue
set foundNames to q name of cues whose midi byte two > hasValue
set foundProperties to midi byte two of cues whose midi byte two > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (midi byte two ≥ lowerRange and midi byte two ≤ hasValue)
set foundNumbers to q number of cues whose (midi byte two ≥ lowerRange and midi byte two ≤ hasValue)
set foundNames to q name of cues whose (midi byte two ≥ lowerRange and midi byte two ≤ hasValue)
set foundProperties to midi byte two of cues whose (midi byte two ≥ lowerRange and midi byte two ≤ hasValue)
end if
else if whoseProperty is "wall clock hours" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose wall clock hours < hasValue
set foundNumbers to q number of cues whose wall clock hours < hasValue
set foundNames to q name of cues whose wall clock hours < hasValue
set foundProperties to wall clock hours of cues whose wall clock hours < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose wall clock hours is hasValue
set foundNumbers to q number of cues whose wall clock hours is hasValue
set foundNames to q name of cues whose wall clock hours is hasValue
set foundProperties to wall clock hours of cues whose wall clock hours is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose wall clock hours > hasValue
set foundNumbers to q number of cues whose wall clock hours > hasValue
set foundNames to q name of cues whose wall clock hours > hasValue
set foundProperties to wall clock hours of cues whose wall clock hours > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (wall clock hours ≥ lowerRange and wall clock hours ≤ hasValue)
set foundNumbers to q number of cues whose (wall clock hours ≥ lowerRange and wall clock hours ≤ hasValue)
set foundNames to q name of cues whose (wall clock hours ≥ lowerRange and wall clock hours ≤ hasValue)
set foundProperties to wall clock hours of cues whose (wall clock hours ≥ lowerRange and wall clock hours ≤ hasValue)
end if
else if whoseProperty is "wall clock minutes" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose wall clock minutes < hasValue
set foundNumbers to q number of cues whose wall clock minutes < hasValue
set foundNames to q name of cues whose wall clock minutes < hasValue
set foundProperties to wall clock minutes of cues whose wall clock minutes < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose wall clock minutes is hasValue
set foundNumbers to q number of cues whose wall clock minutes is hasValue
set foundNames to q name of cues whose wall clock minutes is hasValue
set foundProperties to wall clock minutes of cues whose wall clock minutes is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose wall clock minutes > hasValue
set foundNumbers to q number of cues whose wall clock minutes > hasValue
set foundNames to q name of cues whose wall clock minutes > hasValue
set foundProperties to wall clock minutes of cues whose wall clock minutes > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (wall clock minutes ≥ lowerRange and wall clock minutes ≤ hasValue)
set foundNumbers to q number of cues whose (wall clock minutes ≥ lowerRange and wall clock minutes ≤ hasValue)
set foundNames to q name of cues whose (wall clock minutes ≥ lowerRange and wall clock minutes ≤ hasValue)
set foundProperties to wall clock minutes of cues whose (wall clock minutes ≥ lowerRange and wall clock minutes ≤ hasValue)
end if
else if whoseProperty is "wall clock seconds" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose wall clock seconds < hasValue
set foundNumbers to q number of cues whose wall clock seconds < hasValue
set foundNames to q name of cues whose wall clock seconds < hasValue
set foundProperties to wall clock seconds of cues whose wall clock seconds < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose wall clock seconds is hasValue
set foundNumbers to q number of cues whose wall clock seconds is hasValue
set foundNames to q name of cues whose wall clock seconds is hasValue
set foundProperties to wall clock seconds of cues whose wall clock seconds is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose wall clock seconds > hasValue
set foundNumbers to q number of cues whose wall clock seconds > hasValue
set foundNames to q name of cues whose wall clock seconds > hasValue
set foundProperties to wall clock seconds of cues whose wall clock seconds > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (wall clock seconds ≥ lowerRange and wall clock seconds ≤ hasValue)
set foundNumbers to q number of cues whose (wall clock seconds ≥ lowerRange and wall clock seconds ≤ hasValue)
set foundNames to q name of cues whose (wall clock seconds ≥ lowerRange and wall clock seconds ≤ hasValue)
set foundProperties to wall clock seconds of cues whose (wall clock seconds ≥ lowerRange and wall clock seconds ≤ hasValue)
end if
else if whoseProperty is "loop count" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose loop count < hasValue
set foundNumbers to q number of cues whose loop count < hasValue
set foundNames to q name of cues whose loop count < hasValue
set foundProperties to loop count of cues whose loop count < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose loop count is hasValue
set foundNumbers to q number of cues whose loop count is hasValue
set foundNames to q name of cues whose loop count is hasValue
set foundProperties to loop count of cues whose loop count is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose loop count > hasValue
set foundNumbers to q number of cues whose loop count > hasValue
set foundNames to q name of cues whose loop count > hasValue
set foundProperties to loop count of cues whose loop count > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (loop count ≥ lowerRange and loop count ≤ hasValue)
set foundNumbers to q number of cues whose (loop count ≥ lowerRange and loop count ≤ hasValue)
set foundNames to q name of cues whose (loop count ≥ lowerRange and loop count ≤ hasValue)
set foundProperties to loop count of cues whose (loop count ≥ lowerRange and loop count ≤ hasValue)
end if
else if whoseProperty is "layer" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose layer < hasValue
set foundNumbers to q number of cues whose layer < hasValue
set foundNames to q name of cues whose layer < hasValue
set foundProperties to layer of cues whose layer < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose layer is hasValue
set foundNumbers to q number of cues whose layer is hasValue
set foundNames to q name of cues whose layer is hasValue
set foundProperties to layer of cues whose layer is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose layer > hasValue
set foundNumbers to q number of cues whose layer > hasValue
set foundNames to q name of cues whose layer > hasValue
set foundProperties to layer of cues whose layer > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (layer ≥ lowerRange and layer ≤ hasValue)
set foundNumbers to q number of cues whose (layer ≥ lowerRange and layer ≤ hasValue)
set foundNames to q name of cues whose (layer ≥ lowerRange and layer ≤ hasValue)
set foundProperties to layer of cues whose (layer ≥ lowerRange and layer ≤ hasValue)
end if
else if whoseProperty is "byte one" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose command is not pitch_bend and byte one < hasValue
set foundNumbers to q number of cues whose command is not pitch_bend and byte one < hasValue
set foundNames to q name of cues whose command is not pitch_bend and byte one < hasValue
set foundProperties to byte one of cues whose command is not pitch_bend and byte one < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose command is not pitch_bend and byte one is hasValue
set foundNumbers to q number of cues whose command is not pitch_bend and byte one is hasValue
set foundNames to q name of cues whose command is not pitch_bend and byte one is hasValue
set foundProperties to byte one of cues whose command is not pitch_bend and byte one is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose command is not pitch_bend and byte one > hasValue
set foundNumbers to q number of cues whose command is not pitch_bend and byte one > hasValue
set foundNames to q name of cues whose command is not pitch_bend and byte one > hasValue
set foundProperties to byte one of cues whose command is not pitch_bend and byte one > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose command is not pitch_bend and (byte one ≥ lowerRange and byte one ≤ hasValue)
set foundNumbers to q number of cues whose command is not pitch_bend and (byte one ≥ lowerRange and byte one ≤ hasValue)
set foundNames to q name of cues whose command is not pitch_bend and (byte one ≥ lowerRange and byte one ≤ hasValue)
set foundProperties to byte one of cues whose command is not pitch_bend and (byte one ≥ lowerRange and byte one ≤ hasValue)
end if
else if whoseProperty is "byte two" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose command is not pitch_bend and byte two < hasValue
set foundNumbers to q number of cues whose command is not pitch_bend and byte two < hasValue
set foundNames to q name of cues whose command is not pitch_bend and byte two < hasValue
set foundProperties to byte two of cues whose command is not pitch_bend and byte two < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose command is not pitch_bend and byte two is hasValue
set foundNumbers to q number of cues whose command is not pitch_bend and byte two is hasValue
set foundNames to q name of cues whose command is not pitch_bend and byte two is hasValue
set foundProperties to byte two of cues whose command is not pitch_bend and byte two is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose command is not pitch_bend and byte two > hasValue
set foundNumbers to q number of cues whose command is not pitch_bend and byte two > hasValue
set foundNames to q name of cues whose command is not pitch_bend and byte two > hasValue
set foundProperties to byte two of cues whose command is not pitch_bend and byte two > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose command is not pitch_bend and (byte two ≥ lowerRange and byte two ≤ hasValue)
set foundNumbers to q number of cues whose command is not pitch_bend and (byte two ≥ lowerRange and byte two ≤ hasValue)
set foundNames to q name of cues whose command is not pitch_bend and (byte two ≥ lowerRange and byte two ≤ hasValue)
set foundProperties to byte two of cues whose command is not pitch_bend and (byte two ≥ lowerRange and byte two ≤ hasValue)
end if
else if whoseProperty is "byte combo" then
set hasValueOffset to hasValue + 8192 -- Pitch bend of 0 in the Inspector is reported to AppleScript as 8192
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose command is pitch_bend and byte combo < hasValueOffset
set foundNumbers to q number of cues whose command is pitch_bend and byte combo < hasValueOffset
set foundNames to q name of cues whose command is pitch_bend and byte combo < hasValueOffset
set foundProperties to byte combo of cues whose command is pitch_bend and byte combo < hasValueOffset
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose command is pitch_bend and byte combo is hasValueOffset
set foundNumbers to q number of cues whose command is pitch_bend and byte combo is hasValueOffset
set foundNames to q name of cues whose command is pitch_bend and byte combo is hasValueOffset
set foundProperties to byte combo of cues whose command is pitch_bend and byte combo is hasValueOffset
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose command is pitch_bend and byte combo > hasValueOffset
set foundNumbers to q number of cues whose command is pitch_bend and byte combo > hasValueOffset
set foundNames to q name of cues whose command is pitch_bend and byte combo > hasValueOffset
set foundProperties to byte combo of cues whose command is pitch_bend and byte combo > hasValueOffset
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose command is pitch_bend and (byte combo ≥ lowerRange and byte combo ≤ hasValueOffset)
set foundNumbers to q number of cues whose command is pitch_bend and (byte combo ≥ lowerRange and byte combo ≤ hasValueOffset)
set foundNames to q name of cues whose command is pitch_bend and (byte combo ≥ lowerRange and byte combo ≤ hasValueOffset)
set foundProperties to byte combo of cues whose command is pitch_bend and (byte combo ≥ lowerRange and byte combo ≤ hasValueOffset)
end if
repeat with i from 1 to count foundProperties
set (item i of foundProperties) to ((item i of foundProperties) - 8192)
end repeat
else if whoseProperty is "end value" then
set allMIDIIDs to uniqueID of cues whose q type is "MIDI"
set allMIDINumbers to q number of cues whose q type is "MIDI"
set allMIDINames to q name of cues whose q type is "MIDI"
set allMIDICommands to command of cues whose q type is "MIDI"
set allMIDIEndValues to end value of cues whose q type is "MIDI"
set countMIDI to count allMIDIIDs
repeat with i from 1 to countMIDI -- Origin offset for pitch bend
if item i of allMIDICommands is pitch_bend then
set (item i of allMIDIEndValues) to ((item i of allMIDIEndValues) - 8192)
end if
end repeat
repeat with i from 1 to countMIDI
set eachEndValue to item i of allMIDIEndValues
if theQualifier is "less than" then
if eachEndValue < hasValue then
copy (item i of allMIDIIDs) as string to end of foundIDs
copy (item i of allMIDINumbers) as string to end of foundNumbers
copy (item i of allMIDINames) as string to end of foundNames
copy eachEndValue as string to end of foundProperties
end if
else if theQualifier is "equal to" then
if eachEndValue is hasValue then
copy (item i of allMIDIIDs) as string to end of foundIDs
copy (item i of allMIDINumbers) as string to end of foundNumbers
copy (item i of allMIDINames) as string to end of foundNames
copy eachEndValue as string to end of foundProperties
end if
else if theQualifier is "greater than" then
if eachEndValue > hasValue then
copy (item i of allMIDIIDs) as string to end of foundIDs
copy (item i of allMIDINumbers) as string to end of foundNumbers
copy (item i of allMIDINames) as string to end of foundNames
copy eachEndValue as string to end of foundProperties
end if
else if theQualifier is "in the range" then
if eachEndValue ≥ lowerRange and eachEndValue ≤ hasValue then
copy (item i of allMIDIIDs) as string to end of foundIDs
copy (item i of allMIDINumbers) as string to end of foundNumbers
copy (item i of allMIDINames) as string to end of foundNames
copy eachEndValue as string to end of foundProperties
end if
end if
end repeat
else if whoseProperty is "hours" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose hours < hasValue
set foundNumbers to q number of cues whose hours < hasValue
set foundNames to q name of cues whose hours < hasValue
set foundProperties to hours of cues whose hours < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose hours is hasValue
set foundNumbers to q number of cues whose hours is hasValue
set foundNames to q name of cues whose hours is hasValue
set foundProperties to hours of cues whose hours is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose hours > hasValue
set foundNumbers to q number of cues whose hours > hasValue
set foundNames to q name of cues whose hours > hasValue
set foundProperties to hours of cues whose hours > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (hours ≥ lowerRange and hours ≤ hasValue)
set foundNumbers to q number of cues whose (hours ≥ lowerRange and hours ≤ hasValue)
set foundNames to q name of cues whose (hours ≥ lowerRange and hours ≤ hasValue)
set foundProperties to hours of cues whose (hours ≥ lowerRange and hours ≤ hasValue)
end if
else if whoseProperty is "minutes" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose minutes < hasValue
set foundNumbers to q number of cues whose minutes < hasValue
set foundNames to q name of cues whose minutes < hasValue
set foundProperties to minutes of cues whose minutes < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose minutes is hasValue
set foundNumbers to q number of cues whose minutes is hasValue
set foundNames to q name of cues whose minutes is hasValue
set foundProperties to minutes of cues whose minutes is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose minutes > hasValue
set foundNumbers to q number of cues whose minutes > hasValue
set foundNames to q name of cues whose minutes > hasValue
set foundProperties to minutes of cues whose minutes > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (minutes ≥ lowerRange and minutes ≤ hasValue)
set foundNumbers to q number of cues whose (minutes ≥ lowerRange and minutes ≤ hasValue)
set foundNames to q name of cues whose (minutes ≥ lowerRange and minutes ≤ hasValue)
set foundProperties to minutes of cues whose (minutes ≥ lowerRange and minutes ≤ hasValue)
end if
else if whoseProperty is "seconds" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose seconds < hasValue
set foundNumbers to q number of cues whose seconds < hasValue
set foundNames to q name of cues whose seconds < hasValue
set foundProperties to seconds of cues whose seconds < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose seconds is hasValue
set foundNumbers to q number of cues whose seconds is hasValue
set foundNames to q name of cues whose seconds is hasValue
set foundProperties to seconds of cues whose seconds is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose seconds > hasValue
set foundNumbers to q number of cues whose seconds > hasValue
set foundNames to q name of cues whose seconds > hasValue
set foundProperties to seconds of cues whose seconds > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (seconds ≥ lowerRange and seconds ≤ hasValue)
set foundNumbers to q number of cues whose (seconds ≥ lowerRange and seconds ≤ hasValue)
set foundNames to q name of cues whose (seconds ≥ lowerRange and seconds ≤ hasValue)
set foundProperties to seconds of cues whose (seconds ≥ lowerRange and seconds ≤ hasValue)
end if
else if whoseProperty is "frames" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose frames < hasValue
set foundNumbers to q number of cues whose frames < hasValue
set foundNames to q name of cues whose frames < hasValue
set foundProperties to frames of cues whose frames < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose frames is hasValue
set foundNumbers to q number of cues whose frames is hasValue
set foundNames to q name of cues whose frames is hasValue
set foundProperties to frames of cues whose frames is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose frames > hasValue
set foundNumbers to q number of cues whose frames > hasValue
set foundNames to q name of cues whose frames > hasValue
set foundProperties to frames of cues whose frames > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (frames ≥ lowerRange and frames ≤ hasValue)
set foundNumbers to q number of cues whose (frames ≥ lowerRange and frames ≤ hasValue)
set foundNames to q name of cues whose (frames ≥ lowerRange and frames ≤ hasValue)
set foundProperties to frames of cues whose (frames ≥ lowerRange and frames ≤ hasValue)
end if
else if whoseProperty is "subframes" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose subframes < hasValue
set foundNumbers to q number of cues whose subframes < hasValue
set foundNames to q name of cues whose subframes < hasValue
set foundProperties to subframes of cues whose subframes < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose subframes is hasValue
set foundNumbers to q number of cues whose subframes is hasValue
set foundNames to q name of cues whose subframes is hasValue
set foundProperties to subframes of cues whose subframes is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose subframes > hasValue
set foundNumbers to q number of cues whose subframes > hasValue
set foundNames to q name of cues whose subframes > hasValue
set foundProperties to subframes of cues whose subframes > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (subframes ≥ lowerRange and subframes ≤ hasValue)
set foundNumbers to q number of cues whose (subframes ≥ lowerRange and subframes ≤ hasValue)
set foundNames to q name of cues whose (subframes ≥ lowerRange and subframes ≤ hasValue)
set foundProperties to subframes of cues whose (subframes ≥ lowerRange and subframes ≤ hasValue)
end if
else if whoseProperty is "unique id" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose uniqueID < hasValue
set foundNumbers to q number of cues whose uniqueID < hasValue
set foundNames to q name of cues whose uniqueID < hasValue
set foundProperties to uniqueID of cues whose uniqueID < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose uniqueID is hasValue
set foundNumbers to q number of cues whose uniqueID is hasValue
set foundNames to q name of cues whose uniqueID is hasValue
set foundProperties to uniqueID of cues whose uniqueID is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose uniqueID > hasValue
set foundNumbers to q number of cues whose uniqueID > hasValue
set foundNames to q name of cues whose uniqueID > hasValue
set foundProperties to uniqueID of cues whose uniqueID > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (uniqueID ≥ lowerRange and uniqueID ≤ hasValue)
set foundNumbers to q number of cues whose (uniqueID ≥ lowerRange and uniqueID ≤ hasValue)
set foundNames to q name of cues whose (uniqueID ≥ lowerRange and uniqueID ≤ hasValue)
set foundProperties to uniqueID of cues whose (uniqueID ≥ lowerRange and uniqueID ≤ hasValue)
end if
else if whoseProperty is "start value" then
set allMIDIIDs to uniqueID of cues whose q type is "MIDI"
set allMIDINumbers to q number of cues whose q type is "MIDI"
set allMIDINames to q name of cues whose q type is "MIDI"
set allMIDICommands to command of cues whose q type is "MIDI"
set allMIDIstartValues to start value of cues whose q type is "MIDI"
set countMIDI to count allMIDIIDs
repeat with i from 1 to countMIDI -- Origin offset for pitch bend
if item i of allMIDICommands is pitch_bend then
set (item i of allMIDIstartValues) to ((item i of allMIDIstartValues) - 8192)
end if
end repeat
repeat with i from 1 to countMIDI
set eachstartValue to item i of allMIDIstartValues
if theQualifier is "less than" then
if eachstartValue < hasValue then
copy (item i of allMIDIIDs) as string to end of foundIDs
copy (item i of allMIDINumbers) as string to end of foundNumbers
copy (item i of allMIDINames) as string to end of foundNames
copy eachstartValue as string to end of foundProperties
end if
else if theQualifier is "equal to" then
if eachstartValue is hasValue then
copy (item i of allMIDIIDs) as string to end of foundIDs
copy (item i of allMIDINumbers) as string to end of foundNumbers
copy (item i of allMIDINames) as string to end of foundNames
copy eachstartValue as string to end of foundProperties
end if
else if theQualifier is "greater than" then
if eachstartValue > hasValue then
copy (item i of allMIDIIDs) as string to end of foundIDs
copy (item i of allMIDINumbers) as string to end of foundNumbers
copy (item i of allMIDINames) as string to end of foundNames
copy eachstartValue as string to end of foundProperties
end if
else if theQualifier is "in the range" then
if eachstartValue ≥ lowerRange and eachstartValue ≤ hasValue then
copy (item i of allMIDIIDs) as string to end of foundIDs
copy (item i of allMIDINumbers) as string to end of foundNumbers
copy (item i of allMIDINames) as string to end of foundNames
copy eachstartValue as string to end of foundProperties
end if
end if
end repeat
end if
if theQualifier is "in the range" then
set theVerb to theVerb & " from \"" & lowerRange & "\" to"
end if
end if
-- Get results for "integer is"
if whoseProperty is in indexIntegerIs then
set hasValue to my enterAnInteger("Find all cues whose \"" & whoseProperty & "\" is (integer):", "")
my startTheClock()
if whoseProperty is "ltc sync channel" then
set foundIDs to uniqueID of cues whose ltc sync channel is hasValue
set foundNumbers to q number of cues whose ltc sync channel is hasValue
set foundNames to q name of cues whose ltc sync channel is hasValue
else if whoseProperty is "patch" then
set foundIDs to uniqueID of cues whose patch is hasValue
set foundNumbers to q number of cues whose patch is hasValue
set foundNames to q name of cues whose patch is hasValue
else if whoseProperty is "channel" then
set foundIDs to uniqueID of cues whose channel is hasValue
set foundNumbers to q number of cues whose channel is hasValue
set foundNames to q name of cues whose channel is hasValue
else if whoseProperty is "macro" then
set foundIDs to uniqueID of cues whose macro is hasValue
set foundNumbers to q number of cues whose macro is hasValue
set foundNames to q name of cues whose macro is hasValue
else if whoseProperty is "control number" then
set foundIDs to uniqueID of cues whose control number is hasValue
set foundNumbers to q number of cues whose control number is hasValue
set foundNames to q name of cues whose control number is hasValue
else if whoseProperty is "control value" then
set foundIDs to uniqueID of cues whose control value is hasValue
set foundNumbers to q number of cues whose control value is hasValue
set foundNames to q name of cues whose control value is hasValue
else if whoseProperty is "audio input channels" then
set foundIDs to uniqueID of cues whose audio input channels is hasValue
set foundNumbers to q number of cues whose audio input channels is hasValue
set foundNames to q name of cues whose audio input channels is hasValue
end if
end if
-- Get results for "real range"
if whoseProperty is in indexRealRange then
set theQualifier to my pickFromList(valuesRealRange, "Find all cues whose \"" & whoseProperty & "\" is:")
set theVerb to "is " & theQualifier
if theQualifier is not "in the range" then
set hasValue to my enterANumber("Find all cues whose \"" & whoseProperty & "\" " & theVerb & ":", "")
else
set lowerRange to my enterANumber("Enter the lower end of the range:", "")
set hasValue to my enterANumber("Enter the upper end of the range:", "")
end if
my startTheClock()
if whoseProperty is "opacity" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose opacity < hasValue
set foundNumbers to q number of cues whose opacity < hasValue
set foundNames to q name of cues whose opacity < hasValue
set foundProperties to opacity of cues whose opacity < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose opacity is hasValue
set foundNumbers to q number of cues whose opacity is hasValue
set foundNames to q name of cues whose opacity is hasValue
set foundProperties to opacity of cues whose opacity is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose opacity > hasValue
set foundNumbers to q number of cues whose opacity > hasValue
set foundNames to q name of cues whose opacity > hasValue
set foundProperties to opacity of cues whose opacity > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (opacity ≥ lowerRange and opacity ≤ hasValue)
set foundNumbers to q number of cues whose (opacity ≥ lowerRange and opacity ≤ hasValue)
set foundNames to q name of cues whose (opacity ≥ lowerRange and opacity ≤ hasValue)
set foundProperties to opacity of cues whose (opacity ≥ lowerRange and opacity ≤ hasValue)
end if
else if whoseProperty is "translation x" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose translation x < hasValue
set foundNumbers to q number of cues whose translation x < hasValue
set foundNames to q name of cues whose translation x < hasValue
set foundProperties to translation x of cues whose translation x < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose translation x is hasValue
set foundNumbers to q number of cues whose translation x is hasValue
set foundNames to q name of cues whose translation x is hasValue
set foundProperties to translation x of cues whose translation x is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose translation x > hasValue
set foundNumbers to q number of cues whose translation x > hasValue
set foundNames to q name of cues whose translation x > hasValue
set foundProperties to translation x of cues whose translation x > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (translation x ≥ lowerRange and translation x ≤ hasValue)
set foundNumbers to q number of cues whose (translation x ≥ lowerRange and translation x ≤ hasValue)
set foundNames to q name of cues whose (translation x ≥ lowerRange and translation x ≤ hasValue)
set foundProperties to translation x of cues whose (translation x ≥ lowerRange and translation x ≤ hasValue)
end if
else if whoseProperty is "translation y" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose translation y < hasValue
set foundNumbers to q number of cues whose translation y < hasValue
set foundNames to q name of cues whose translation y < hasValue
set foundProperties to translation y of cues whose translation y < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose translation y is hasValue
set foundNumbers to q number of cues whose translation y is hasValue
set foundNames to q name of cues whose translation y is hasValue
set foundProperties to translation y of cues whose translation y is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose translation y > hasValue
set foundNumbers to q number of cues whose translation y > hasValue
set foundNames to q name of cues whose translation y > hasValue
set foundProperties to translation y of cues whose translation y > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (translation y ≥ lowerRange and translation y ≤ hasValue)
set foundNumbers to q number of cues whose (translation y ≥ lowerRange and translation y ≤ hasValue)
set foundNames to q name of cues whose (translation y ≥ lowerRange and translation y ≤ hasValue)
set foundProperties to translation y of cues whose (translation y ≥ lowerRange and translation y ≤ hasValue)
end if
else if whoseProperty is "rotation" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose rotation < hasValue
set foundNumbers to q number of cues whose rotation < hasValue
set foundNames to q name of cues whose rotation < hasValue
set foundProperties to rotation of cues whose rotation < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose rotation is hasValue
set foundNumbers to q number of cues whose rotation is hasValue
set foundNames to q name of cues whose rotation is hasValue
set foundProperties to rotation of cues whose rotation is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose rotation > hasValue
set foundNumbers to q number of cues whose rotation > hasValue
set foundNames to q name of cues whose rotation > hasValue
set foundProperties to rotation of cues whose rotation > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (rotation ≥ lowerRange and rotation ≤ hasValue)
set foundNumbers to q number of cues whose (rotation ≥ lowerRange and rotation ≤ hasValue)
set foundNames to q name of cues whose (rotation ≥ lowerRange and rotation ≤ hasValue)
set foundProperties to rotation of cues whose (rotation ≥ lowerRange and rotation ≤ hasValue)
end if
else if whoseProperty is "scale x" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose scale x < hasValue
set foundNumbers to q number of cues whose scale x < hasValue
set foundNames to q name of cues whose scale x < hasValue
set foundProperties to scale x of cues whose scale x < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose scale x is hasValue
set foundNumbers to q number of cues whose scale x is hasValue
set foundNames to q name of cues whose scale x is hasValue
set foundProperties to scale x of cues whose scale x is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose scale x > hasValue
set foundNumbers to q number of cues whose scale x > hasValue
set foundNames to q name of cues whose scale x > hasValue
set foundProperties to scale x of cues whose scale x > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (scale x ≥ lowerRange and scale x ≤ hasValue)
set foundNumbers to q number of cues whose (scale x ≥ lowerRange and scale x ≤ hasValue)
set foundNames to q name of cues whose (scale x ≥ lowerRange and scale x ≤ hasValue)
set foundProperties to scale x of cues whose (scale x ≥ lowerRange and scale x ≤ hasValue)
end if
else if whoseProperty is "scale y" then
if theQualifier is "less than" then
set foundIDs to uniqueID of cues whose scale y < hasValue
set foundNumbers to q number of cues whose scale y < hasValue
set foundNames to q name of cues whose scale y < hasValue
set foundProperties to scale y of cues whose scale y < hasValue
else if theQualifier is "equal to" then
set foundIDs to uniqueID of cues whose scale y is hasValue
set foundNumbers to q number of cues whose scale y is hasValue
set foundNames to q name of cues whose scale y is hasValue
set foundProperties to scale y of cues whose scale y is hasValue
else if theQualifier is "greater than" then
set foundIDs to uniqueID of cues whose scale y > hasValue
set foundNumbers to q number of cues whose scale y > hasValue
set foundNames to q name of cues whose scale y > hasValue
set foundProperties to scale y of cues whose scale y > hasValue
else if theQualifier is "in the range" then
set foundIDs to uniqueID of cues whose (scale y ≥ lowerRange and scale y ≤ hasValue)
set foundNumbers to q number of cues whose (scale y ≥ lowerRange and scale y ≤ hasValue)
set foundNames to q name of cues whose (scale y ≥ lowerRange and scale y ≤ hasValue)
set foundProperties to scale y of cues whose (scale y ≥ lowerRange and scale y ≤ hasValue)
end if
end if
if theQualifier is "in the range" then
set theVerb to theVerb & " from \"" & lowerRange & "\" to"
end if
end if
-- End of indexes; unique properties
if whoseProperty is "type" then
set hasValue to my pickFromList(values1_q_type, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
repeat with i from 1 to count values1_q_type_Expanded
if hasValue is item i of values1_q_type_Expanded then
set hasValue to item i of values1_q_type_DictionaryOrder
exit repeat
end if
end repeat
if hasValue is "Cue List" then -- Special case (no cue has q type "Cue List")
set foundIDs to uniqueID of cues whose (q type is "Group" and mode is cue_list)
set foundNumbers to q number of cues whose (q type is "Group" and mode is cue_list)
set foundNames to q name of cues whose (q type is "Group" and mode is cue_list)
else
set foundIDs to uniqueID of cues whose q type is hasValue
set foundNumbers to q number of cues whose q type is hasValue
set foundNames to q name of cues whose q type is hasValue
end if
if hasValue is "Audio" or hasValue is "Video" then -- Additional reporting
set whosePropertyHeader to "file target"
set foundCues to cues whose q type is hasValue
set foundCuesRef to a reference to foundCues
repeat with i from 1 to count foundCuesRef -- This has to be iterated as "file targets of cues whose q type is hasValue"
(* will throw on error if any cues have never had a file target *)
set eachCue to item i of foundCuesRef
try -- This try protects against cues that have never had targets
set targetFile to (file target of eachCue) as string
if targetFile is "missing value" then -- This string will be returned by cues whose targets have become invalid
set targetFile to " ****Previously valid file target now missing**** "
else if targetFile is not "" then
set targetFile to (POSIX path of (targetFile as alias)) as string -- Convert to POSIX
end if
on error
set targetFile to " ****File target never set**** "
end try
copy targetFile to end of foundProperties
end repeat
else if hasValue is "MIDI" then -- Additional reporting
set whosePropertyHeader to "command" & tab & "byte one" & tab & "byte two" & tab & "byte combo"
set foundProperties0 to command of cues whose q type is hasValue
set foundProperties1 to byte one of cues whose q type is hasValue
set foundProperties2 to byte two of cues whose q type is hasValue
set foundProperties3 to byte combo of cues whose q type is hasValue
repeat with i from 1 to count foundProperties0
if item i of foundProperties0 is not pitch_bend then
set item i of foundProperties3 to ""
else
set item i of foundProperties1 to ""
set item i of foundProperties2 to ""
set (item i of foundProperties3) to (item i of foundProperties3) - 8192
end if
copy ((((item i of foundProperties0 as string) & tab & (item i of foundProperties1) as string) & tab & ¬
(item i of foundProperties2) as string) & tab & (item i of foundProperties3) as string) to end of foundProperties
end repeat
else if hasValue is "MSC" then -- Additional reporting
set whosePropertyHeader to "command format" & tab & "command number" & tab & "q_number" & tab & "q_list" & tab & "q_path" & tab & ¬
"macro" & tab & "control number" & tab & "control value" & tab & "timecode" & tab & "send time with set"
set foundProperties0 to command format of cues whose q type is hasValue
set foundProperties1 to command number of cues whose q type is hasValue
set foundProperties2 to q_number of cues whose q type is hasValue
set foundProperties3 to q_list of cues whose q type is hasValue
set foundProperties4 to q_path of cues whose q type is hasValue
set foundProperties5 to macro of cues whose q type is hasValue
set foundProperties6 to control number of cues whose q type is hasValue
set foundProperties7 to control value of cues whose q type is hasValue
set foundProperties8 to hours of cues whose q type is hasValue
set foundProperties9 to minutes of cues whose q type is hasValue
set foundProperties10 to seconds of cues whose q type is hasValue
set foundProperties11 to frames of cues whose q type is hasValue
set foundProperties12 to subframes of cues whose q type is hasValue
set foundProperties13 to send time with set of cues whose q type is hasValue
repeat with i from 1 to count foundProperties0
set theFormat to item i of foundProperties0 as string
repeat with j from 1 to count translation61_command_format by 2
if theFormat is item j of translation61_command_format then
set theFormat to item (j + 1) of translation61_command_format
exit repeat
end if
end repeat
set theNumber to item i of foundProperties1 as string
repeat with j from 1 to count translation62_command_number by 2
if theNumber is item j of translation62_command_number then
set theNumber to item (j + 1) of translation62_command_number
exit repeat
end if
end repeat
copy (theFormat & tab & theNumber & ¬
tab & ((item i of foundProperties2) as string) & ¬
tab & ((item i of foundProperties3) as string) & ¬
tab & ((item i of foundProperties4) as string) & ¬
tab & ((item i of foundProperties5) as string) & ¬
tab & ((item i of foundProperties6) as string) & ¬
tab & ((item i of foundProperties7) as string) & ¬
tab & my padWithZeroes((item i of foundProperties8) as string, 2) & ¬
":" & my padWithZeroes((item i of foundProperties9) as string, 2) & ¬
":" & my padWithZeroes((item i of foundProperties10) as string, 2) & ¬
":" & my padWithZeroes((item i of foundProperties11) as string, 2) & ¬
"." & my padWithZeroes((item i of foundProperties12) as string, 2) & ¬
tab & ((item i of foundProperties13) as string)) to end of foundProperties
end repeat
else if hasValue is "MIDI SysEx" then -- Additional reporting
set whosePropertyHeader to "sysex message"
set foundProperties to sysex message of cues whose q type is hasValue
end if
end if
if whoseProperty is "cue target" then
set hasValue to my enterSomeText("Find all cues whose \"" & whoseProperty & "\" is (enter the cue number):", "")
set theVerb to "is cue number"
my startTheClock()
try
set theCueTarget to the first cue whose q number is hasValue
set foundIDs to uniqueID of cues whose cue target is theCueTarget
set foundNumbers to q number of cues whose cue target is theCueTarget
set foundNames to q name of cues whose cue target is theCueTarget
end try
end if
if whoseProperty is "file target" then
set hasValue to my enterSomeText("Find all cues whose \"" & whoseProperty & "\" contains:", "")
set theVerb to "contains"
my startTheClock()
set allAVIDs to uniqueID of cues whose ((q type is "Audio" or q type is "video") and broken is false)
set allAVNumbers to q number of cues whose ((q type is "Audio" or q type is "video") and broken is false)
set allAVNames to q name of cues whose ((q type is "Audio" or q type is "video") and broken is false)
set allAVTargets to file target of cues whose ((q type is "Audio" or q type is "video") and broken is false)
repeat with i from 1 to count allAVIDs
if ((item i of allAVTargets) as string) contains hasValue then
copy (item i of allAVIDs) as string to end of foundIDs
copy (item i of allAVNumbers) as string to end of foundNumbers
copy (item i of allAVNames) as string to end of foundNames
copy (POSIX path of ((item i of allAVTargets) as alias) as string) to end of foundProperties
end if
end repeat
end if
if whoseProperty is "continue mode" then
set hasValue to my pickFromList(values10_continue_mode, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
if hasValue is item 1 of values10_continue_mode then
set foundIDs to uniqueID of cues whose continue mode is do_not_continue
set foundNumbers to q number of cues whose continue mode is do_not_continue
set foundNames to q name of cues whose continue mode is do_not_continue
else if hasValue is item 2 of values10_continue_mode then
set foundIDs to uniqueID of cues whose continue mode is auto_continue
set foundNumbers to q number of cues whose continue mode is auto_continue
set foundNames to q name of cues whose continue mode is auto_continue
else if hasValue is item 3 of values10_continue_mode then
set foundIDs to uniqueID of cues whose continue mode is auto_follow
set foundNumbers to q number of cues whose continue mode is auto_follow
set foundNames to q name of cues whose continue mode is auto_follow
end if
end if
if whoseProperty is "midi command" then -- Additional reporting
set hasValue to my pickFromList(values13_midi_command, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
if hasValue is item 1 of values13_midi_command then
set foundIDs to uniqueID of cues whose midi command is note_on
set foundNumbers to q number of cues whose midi command is note_on
set foundNames to q name of cues whose midi command is note_on
set whosePropertyHeader to "trigger" & tab & "byte one" & tab & "byte two"
set foundProperties0 to midi trigger of cues whose midi command is note_on
set foundProperties1 to midi byte one of cues whose midi command is note_on
set foundProperties2 to midi byte two of cues whose midi command is note_on
repeat with i from 1 to count foundProperties1
copy ((((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) & tab & ¬
(item i of foundProperties2) as string) to end of foundProperties
end repeat
else if hasValue is item 2 of values13_midi_command then
set foundIDs to uniqueID of cues whose midi command is note_off
set foundNumbers to q number of cues whose midi command is note_off
set foundNames to q name of cues whose midi command is note_off
set whosePropertyHeader to "trigger" & tab & "byte one" & tab & "byte two"
set foundProperties0 to midi trigger of cues whose midi command is note_off
set foundProperties1 to midi byte one of cues whose midi command is note_off
set foundProperties2 to midi byte two of cues whose midi command is note_off
repeat with i from 1 to count foundProperties1
copy ((((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) & tab & ¬
(item i of foundProperties2) as string) to end of foundProperties
end repeat
else if hasValue is item 3 of values13_midi_command then
set foundIDs to uniqueID of cues whose midi command is program_change
set foundNumbers to q number of cues whose midi command is program_change
set foundNames to q name of cues whose midi command is program_change
set whosePropertyHeader to "trigger" & tab & "byte one"
set foundProperties0 to midi trigger of cues whose midi command is program_change
set foundProperties1 to midi byte one of cues whose midi command is program_change
repeat with i from 1 to count foundProperties1
copy (((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) to end of foundProperties
end repeat
else if hasValue is item 4 of values13_midi_command then
set foundIDs to uniqueID of cues whose midi command is control_change
set foundNumbers to q number of cues whose midi command is control_change
set foundNames to q name of cues whose midi command is control_change
set whosePropertyHeader to "trigger" & tab & "byte one" & tab & "byte two"
set foundProperties0 to midi trigger of cues whose midi command is control_change
set foundProperties1 to midi byte one of cues whose midi command is control_change
set foundProperties2 to midi byte two of cues whose midi command is control_change
repeat with i from 1 to count foundProperties1
copy ((((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) & tab & ¬
(item i of foundProperties2) as string) to end of foundProperties
end repeat
else if hasValue is item 5 of values13_midi_command then
set foundIDs to uniqueID of cues whose midi command is key_pressure
set foundNumbers to q number of cues whose midi command is key_pressure
set foundNames to q name of cues whose midi command is key_pressure
set whosePropertyHeader to "trigger" & tab & "byte one" & tab & "byte two"
set foundProperties0 to midi trigger of cues whose midi command is key_pressure
set foundProperties1 to midi byte one of cues whose midi command is key_pressure
set foundProperties2 to midi byte two of cues whose midi command is key_pressure
repeat with i from 1 to count foundProperties1
copy ((((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) & tab & ¬
(item i of foundProperties2) as string) to end of foundProperties
end repeat
else if hasValue is item 6 of values13_midi_command then
set foundIDs to uniqueID of cues whose midi command is channel_pressure
set foundNumbers to q number of cues whose midi command is channel_pressure
set foundNames to q name of cues whose midi command is channel_pressure
set whosePropertyHeader to "trigger" & tab & "byte one"
set foundProperties0 to midi trigger of cues whose midi command is channel_pressure
set foundProperties1 to midi byte one of cues whose midi command is channel_pressure
repeat with i from 1 to count foundProperties1
copy (((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) to end of foundProperties
end repeat
end if
end if
if whoseProperty is "mode" then
set hasValue to my pickFromList(values21_mode, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
if hasValue is item 1 of values21_mode then
set foundIDs to uniqueID of cues whose mode is cue_list
set foundNumbers to q number of cues whose mode is cue_list
set foundNames to q name of cues whose mode is cue_list
else if hasValue is item 2 of values21_mode then
set foundIDs to uniqueID of cues whose mode is fire_first_enter_group
set foundNumbers to q number of cues whose mode is fire_first_enter_group
set foundNames to q name of cues whose mode is fire_first_enter_group
else if hasValue is item 3 of values21_mode then
set foundIDs to uniqueID of cues whose mode is fire_first_go_to_next_cue
set foundNumbers to q number of cues whose mode is fire_first_go_to_next_cue
set foundNames to q name of cues whose mode is fire_first_go_to_next_cue
else if hasValue is item 4 of values21_mode then
set foundIDs to uniqueID of cues whose mode is fire_all
set foundNumbers to q number of cues whose mode is fire_all
set foundNames to q name of cues whose mode is fire_all
else if hasValue is item 5 of values21_mode then
set foundIDs to uniqueID of cues whose mode is fire_random
set foundNumbers to q number of cues whose mode is fire_random
set foundNames to q name of cues whose mode is fire_random
end if
end if
if whoseProperty is "sync mode" then
set hasValue to my pickFromList(values23_sync_mode, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
if hasValue is item 1 of values23_sync_mode then
set foundIDs to uniqueID of cues whose sync mode is mtc
set foundNumbers to q number of cues whose sync mode is mtc
set foundNames to q name of cues whose sync mode is mtc
else if hasValue is item 2 of values23_sync_mode then
set foundIDs to uniqueID of cues whose sync mode is ltc
set foundNumbers to q number of cues whose sync mode is ltc
set foundNames to q name of cues whose sync mode is ltc
end if
end if
if whoseProperty is "smpte format" then
set hasValue to my pickFromList(values24_smpte_format, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
if hasValue is item 1 of values24_smpte_format then
set foundIDs to uniqueID of cues whose smpte format is fps_24
set foundNumbers to q number of cues whose smpte format is fps_24
set foundNames to q name of cues whose smpte format is fps_24
else if hasValue is item 2 of values24_smpte_format then
set foundIDs to uniqueID of cues whose smpte format is fps_25
set foundNumbers to q number of cues whose smpte format is fps_25
set foundNames to q name of cues whose smpte format is fps_25
else if hasValue is item 3 of values24_smpte_format then
set foundIDs to uniqueID of cues whose smpte format is fps_30_drop
set foundNumbers to q number of cues whose smpte format is fps_30_drop
set foundNames to q name of cues whose smpte format is fps_30_drop
else if hasValue is item 4 of values24_smpte_format then
set foundIDs to uniqueID of cues whose smpte format is fps_30_non_drop
set foundNumbers to q number of cues whose smpte format is fps_30_non_drop
set foundNames to q name of cues whose smpte format is fps_30_non_drop
end if
end if
if whoseProperty is "fade mode" then
set hasValue to my pickFromList(values36_fade_mode, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
if hasValue is item 1 of values36_fade_mode then
set foundIDs to uniqueID of cues whose fade mode is absolute
set foundNumbers to q number of cues whose fade mode is absolute
set foundNames to q name of cues whose fade mode is absolute
else if hasValue is item 2 of values36_fade_mode then
set foundIDs to uniqueID of cues whose fade mode is relative
set foundNumbers to q number of cues whose fade mode is relative
set foundNames to q name of cues whose fade mode is relative
end if
end if
if whoseProperty is "command" then -- Additional reporting
set hasValue to my pickFromList(values54_command, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
if hasValue is item 1 of values54_command then
set foundIDs to uniqueID of cues whose command is note_on
set foundNumbers to q number of cues whose command is note_on
set foundNames to q name of cues whose command is note_on
set whosePropertyHeader to "channel" & tab & "byte one" & tab & "byte two"
set foundProperties0 to channel of cues whose command is note_on
set foundProperties1 to byte one of cues whose command is note_on
set foundProperties2 to byte two of cues whose command is note_on
repeat with i from 1 to count foundProperties1
copy ((((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) & tab & ¬
(item i of foundProperties2) as string) to end of foundProperties
end repeat
else if hasValue is item 2 of values54_command then
set foundIDs to uniqueID of cues whose command is note_off
set foundNumbers to q number of cues whose command is note_off
set foundNames to q name of cues whose command is note_off
set whosePropertyHeader to "channel" & tab & "byte one" & tab & "byte two"
set foundProperties0 to channel of cues whose command is note_off
set foundProperties1 to byte one of cues whose command is note_off
set foundProperties2 to byte two of cues whose command is note_off
repeat with i from 1 to count foundProperties1
copy ((((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) & tab & ¬
(item i of foundProperties2) as string) to end of foundProperties
end repeat
else if hasValue is item 3 of values54_command then
set foundIDs to uniqueID of cues whose command is program_change
set foundNumbers to q number of cues whose command is program_change
set foundNames to q name of cues whose command is program_change
set whosePropertyHeader to "channel" & tab & "byte one"
set foundProperties0 to channel of cues whose command is program_change
set foundProperties1 to byte one of cues whose command is program_change
repeat with i from 1 to count foundProperties1
copy (((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) to end of foundProperties
end repeat
else if hasValue is item 4 of values54_command then
set foundIDs to uniqueID of cues whose command is control_change
set foundNumbers to q number of cues whose command is control_change
set foundNames to q name of cues whose command is control_change
set whosePropertyHeader to "channel" & tab & "byte one" & tab & "byte two"
set foundProperties0 to channel of cues whose command is note_off
set foundProperties1 to byte one of cues whose command is control_change
set foundProperties2 to byte two of cues whose command is control_change
repeat with i from 1 to count foundProperties1
copy ((((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) & tab & ¬
(item i of foundProperties2) as string) to end of foundProperties
end repeat
else if hasValue is item 5 of values54_command then
set foundIDs to uniqueID of cues whose command is key_pressure
set foundNumbers to q number of cues whose command is key_pressure
set foundNames to q name of cues whose command is key_pressure
set whosePropertyHeader to "channel" & tab & "byte one" & tab & "byte two"
set foundProperties0 to channel of cues whose command is note_off
set foundProperties1 to byte one of cues whose command is key_pressure
set foundProperties2 to byte two of cues whose command is key_pressure
repeat with i from 1 to count foundProperties1
copy ((((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) & tab & ¬
(item i of foundProperties2) as string) to end of foundProperties
end repeat
else if hasValue is item 6 of values54_command then
set foundIDs to uniqueID of cues whose command is channel_pressure
set foundNumbers to q number of cues whose command is channel_pressure
set foundNames to q name of cues whose command is channel_pressure
set whosePropertyHeader to "channel" & tab & "byte one"
set foundProperties0 to channel of cues whose command is channel_pressure
set foundProperties1 to byte one of cues whose command is channel_pressure
repeat with i from 1 to count foundProperties1
copy (((item i of foundProperties0) as string) & tab & (item i of foundProperties1) as string) to end of foundProperties
end repeat
else if hasValue is item 7 of values54_command then
set foundIDs to uniqueID of cues whose command is pitch_bend
set foundNumbers to q number of cues whose command is pitch_bend
set foundNames to q name of cues whose command is pitch_bend
set whosePropertyHeader to "channel" & tab & "byte combo"
set foundProperties0 to channel of cues whose command is pitch_bend
set foundProperties1 to byte combo of cues whose command is pitch_bend
repeat with i from 1 to count foundProperties1
copy (((item i of foundProperties0) as string) & tab & ((item i of foundProperties1) - 8192)) as string to end of foundProperties
end repeat
end if
end if
if whoseProperty is "command format" then
set hasValue to my pickFromList(values61_command_format, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
repeat with i from 2 to count translation61_command_format by 2
if hasValue is item i of translation61_command_format then
set theMSC to item (i - 1) of translation61_command_format
exit repeat
end if
end repeat
set foundIDs to uniqueID of cues whose command format is theMSC
set foundNumbers to q number of cues whose command format is theMSC
set foundNames to q name of cues whose command format is theMSC
end if
if whoseProperty is "command number" then
set hasValue to my pickFromList(values62_command_number, "Find all cues whose \"" & whoseProperty & "\" is:")
my startTheClock()
repeat with i from 2 to count translation62_command_number by 2
if hasValue is item i of translation62_command_number then
set theMSC to item (i - 1) of translation62_command_number
exit repeat
end if
end repeat
set foundIDs to uniqueID of cues whose command number is theMSC
set foundNumbers to q number of cues whose command number is theMSC
set foundNames to q name of cues whose command number is theMSC
end if
-- Return the result
set foundIDsRef to a reference to foundIDs
set foundNumbersRef to a reference to foundNumbers
set foundNamesRef to a reference to foundNames
set foundPropertiesRef to a reference to foundProperties
set numberFound to count foundIDsRef
set xIsY to "\"" & whoseProperty & "\" " & theVerb & " \"" & hasValue & "\""
if numberFound is 0 then
display dialog "There are no cues in the workspace \"" & workspaceName & "\" whose " & xIsY & "." with title dialogTitle with icon 0 ¬
buttons {"OK"} default button "OK" giving up after 60
return
else if numberFound is 1 then
set thereAreString to "There is 1 cue in the workspace \""
else
set thereAreString to "There are " & numberFound & " cues in the workspace \""
end if
set timeTaken to ((time of (current date)) - startTime) as integer
set timeString to my makeNiceT(timeTaken)
set whatNext to my pickFromListWithDefault(whatNextChoices, thereAreString & workspaceName & "\" whose " & xIsY & "." & return & return & ¬
"(That took " & timeString & ".)", 2)
-- Prepare text if necessary
if whatNext is in {"Copy to Clipboard", "Open in TextEdit"} then
my startTheClock()
set theText to "unique ID" & tab & "q number" & tab & "q name"
if (count foundPropertiesRef) is not 0 then
set theText to theText & tab & whosePropertyHeader
end if
repeat with i from 1 to numberFound
set eachID to (item i of foundIDsRef) as string
set eachNumber to (item i of foundNumbersRef) as string
set eachName to (item i of foundNamesRef) as string
set theText to (theText & return & eachID & tab & eachNumber & tab & eachName)
if (count foundPropertiesRef) is not 0 then
set eachProperty to (item i of foundPropertiesRef) as string
if whoseProperty is in indexTimess then
set eachProperty to my makeHHMMSSss(eachProperty)
else if whoseProperty is in indexTimesss then
set eachProperty to my makeHHMMSSsss(eachProperty)
else if whoseProperty is "notes" then -- Remove carriage returns from notes text
set cleanText to paragraphs of eachProperty
set currentTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to carriageReturnsInNotes
set eachProperty to cleanText as text
set AppleScript's text item delimiters to currentTIDs
end if
set theText to theText & tab & eachProperty
end if
end repeat
set theText to theText & return & return & "Search: " & xIsY
end if
-- Either, copy to Clipboard
if whatNext is "Copy to Clipboard" then
set the clipboard to theText
display dialog "Copied to Clipboard." with title dialogTitle with icon 1 buttons {"OK"} default button "OK" giving up after 60
-- Or, open in TextEdit
else if whatNext is "Open in TextEdit" then
-- Create a string of the full path of the text file to be created
set newFile to "" & (path to desktop) & "QLab | " & workspaceName & " | " & dialogTitle & " | " & theTime & ".txt"
-- Make the file
copy (open for access newFile with write permission) to theOpenFile
write theText to theOpenFile
close access theOpenFile
-- Open it in TextEdit
tell application "TextEdit"
activate
open file (newFile)
set zoomed of front window to true
set timeTaken to ((time of (current date)) - startTime) as integer
set timeString to my makeNiceT(timeTaken)
display dialog "Done.
(Making the text file took " & timeString & ".)" with title dialogTitle with icon 1 buttons {"OK"} default button "OK" giving up after 60
end tell
-- Or, batch adjust
else if whatNext is "Batch adjust" then
set theSelection to {}
repeat with eachID in foundIDsRef
copy (first cue whose uniqueID is eachID) to end of theSelection
end repeat
set theSelectionRef to a reference to theSelection
-- Modify options if only one cue found
if (count theSelectionRef) is 1 then
set subChoiceName to items 1 thru ((count subChoiceName) - 1) of subChoiceName -- Remove "Make series"
set subChoiceMIDI to items 1 thru ((count subChoiceMIDI) - 1) of subChoiceMIDI -- Remove "Make series"
end if
-- Preamble
set theProcess to ""
repeat until theProcess is "Finished adjusting"
set ohDear to false -- A simple flag to detect problems
set abortAbort to false -- A flag for aborting!
set theProcess to my pickFromList(processChoices, "The script will now attempt to batch adjust properties of the cues whose " & xIsY & ¬
", according to your instructions. NB: this selection will not be updated as you adjust things!
There is some error protection, but it is impossible to make this process completely idiot-proof. You should be warned if something threw an error, " & ¬
"but it's not possible to track exactly what it was.
So that you can run more than one process, you'll keep coming back to this screen until you hit any \"Cancel\" button, or choose \"Finished adjusting\".
Choose a property category:")
-- Find out more about what we're doing, and then call a subroutine to do it...
if theProcess is "Levels" then
my adjustLevels(theSelectionRef, "cues whose " & xIsY)
else if theProcess is "File target" then
my adjustFileTarget(theSelectionRef, "Set", "cues whose " & xIsY)
else if theProcess is "File target (keeping times)" then
my adjustFileTarget(theSelectionRef, "Change", "cues whose " & xIsY)
else if theProcess is "Name" then
set theChoice to my pickFromList(subChoiceName, "Choose how you would like to adjust the names of the cues whose " & xIsY & ":")
if theChoice is "Set" then
my adjustSetName(theSelectionRef, "cues whose " & xIsY)
else if theChoice is "Reset to file target" then
my adjustResetNameToFileTarget(theSelectionRef)
else if theChoice is "Basic search & replace" then
my adjustSearchReplaceName(theSelectionRef, "cues whose " & xIsY)
else if theChoice is "Add prefix" then
my adjustPrefixName(theSelectionRef, "cues whose " & xIsY)
else if theChoice is "Add suffix" then
my adjustSuffixName(theSelectionRef, "cues whose " & xIsY)
else if theChoice is "Make series" then
my adjustSeriesName(theSelectionRef, "cues whose " & xIsY)
end if
else if theProcess is "Notes" then
set theChoice to my pickFromList(subChoiceNotes, "Choose how you would like to adjust the notes of the cues whose " & xIsY & ¬
"(NB: scripting of notes is plain-text only):")
if theChoice is "Clear" then
my adjustClearNotes(theSelectionRef)
else if theChoice is "Set" then
my adjustSetNotes(theSelectionRef, "cues whose " & xIsY)
else if theChoice is "Basic search & replace" then
my adjustSearchReplaceNotes(theSelectionRef, "cues whose " & xIsY)
else if theChoice is "Add prefix" then
my adjustPrefixNotes(theSelectionRef, "cues whose " & xIsY)
else if theChoice is "Add suffix" then
my adjustSuffixNotes(theSelectionRef, "cues whose " & xIsY)
end if
else if theProcess is "Times" then
set parameterChoice to my pickFromList(subChoiceTimesParameter, "Choose the time parameter to adjust:")
set theChoice to my pickFromList(subChoiceTimes, "Choose how you would like to adjust the " & parameterChoice & ¬
" of the cues whose " & xIsY & ":")
if theChoice is "Set" then
my adjustSetTime(theSelectionRef, parameterChoice, "cues whose " & xIsY)
else if theChoice is "Scale" then
my adjustScaleTime(theSelectionRef, parameterChoice, "cues whose " & xIsY)
else if theChoice is "Add/subtract amount" then
my adjustAddSubractTime(theSelectionRef, parameterChoice, "cues whose " & xIsY)
end if
else if theProcess is "MIDI" then
set parameterChoice to my pickFromList(subChoiceMIDIParameter, ¬
"Choose the MIDI parameter to adjust (\"byte combo\" will only affect pitch bend commands):")
if parameterChoice is "channel" then
set theChoice to "set" -- The other options don't make a lot of sense for channel!
else
set theChoice to my pickFromList(subChoiceMIDI, "Choose how you would like to adjust the " & parameterChoice & ¬
" of the cues whose " & xIsY & ":")
end if
if theChoice is "Set" then
my adjustSetMIDI(theSelectionRef, parameterChoice, "cues whose " & xIsY)
else if theChoice is "Scale" then
my adjustScaleMIDI(theSelectionRef, parameterChoice, "cues whose " & xIsY)
else if theChoice is "Add/subtract amount" then
my adjustAddSubractMIDI(theSelectionRef, parameterChoice, "cues whose " & xIsY)
else if theChoice is "Make series" then
my adjustSeriesMIDI(theSelectionRef, parameterChoice, "cues whose " & xIsY)
end if
else if theProcess is "Armed" then
set parameterChoice to my pickFromList(subChoiceArmed, "Set the armed of the cues whose " & xIsY & " to:")
my adjustArmed(theSelectionRef, parameterChoice)
else if theProcess is "Continue mode" then
set parameterChoice to my pickFromList(subChoiceContinueMode, "Set the continue mode of the cues whose " & xIsY & " to:")
my adjustContinueMode(theSelectionRef, parameterChoice)
else if theProcess is "Guarantee sync" then
set parameterChoice to my pickFromList(subChoiceGuaranteeSync, "Set the guarantee sync of the cues whose " & xIsY & " to:")
my adjustGuaranteeSync(theSelectionRef, parameterChoice)
else if theProcess is "Mode" then
set parameterChoice to my pickFromList(subChoiceMode, "Set the mode of the cues whose " & xIsY & " to:")
my adjustMode(theSelectionRef, parameterChoice)
end if
end repeat
-- Or, step through cues (not cue lists)
else if whatNext is "Step through cues (not cue lists)" then
repeat with eachID in foundIDsRef
set eachCue to (first cue whose uniqueID is eachID)
try
set cueListCheck to mode of eachCue -- Exclude cue lists since we can't navigate to them
on error
set cueListCheck to ""
end try
if cueListCheck is not cue_list then
set theContainer to (the first cue whose (q type is "Group" and cues contains eachCue))
repeat until mode of theContainer is cue_list
set theContainer to (the first cue whose (q type is "Group" and cues contains theContainer))
end repeat
set current cue list to theContainer
set playback position of the current cue list to eachCue
activate
display dialog "Search: " & xIsY & return & return & "Here's one..." with title dialogTitle with icon 1 ¬
buttons {"That's the badger", "Next"} default button "Next" cancel button "That's the badger"
end if
end repeat
display dialog "That's your lot." with title dialogTitle with icon 1 buttons {"Small onion"} default button "Small onion"
end if
end tell
end tell
-- Subroutines: input
on pickFromList(theChoice, thePrompt)
tell application "QLab"
choose from list theChoice with prompt thePrompt with title dialogTitle default items item 1 of theChoice
if the result is not false then
return item 1 of the result
else
error number -128
end if
end tell
end pickFromList
on pickFromListWithDefault(theChoice, thePrompt, defaultItem)
tell application "QLab"
choose from list theChoice with prompt thePrompt with title dialogTitle default items item defaultItem of theChoice
if the result is not false then
return item 1 of the result
else
error number -128
end if
end tell
end pickFromListWithDefault
on enterSomeText(thePrompt, defaultAnswer)
tell application "QLab"
set theAnswer to ""
repeat until theAnswer is not ""
set theAnswer to text returned of (display dialog thePrompt with title dialogTitle default answer defaultAnswer buttons {"Cancel", "OK"} ¬
default button "OK" cancel button "Cancel")
end repeat
return theAnswer
end tell
end enterSomeText
on enterAnInteger(thePrompt, defaultAnswer)
tell application "QLab"
set theQuestion to ""
repeat until theQuestion is not ""
set theQuestion to text returned of (display dialog thePrompt with title dialogTitle default answer defaultAnswer buttons {"Cancel", "OK"} ¬
default button "OK" cancel button "Cancel")
try
set theAnswer to theQuestion as integer
on error
set theQuestion to ""
end try
end repeat
return theAnswer
end tell
end enterAnInteger
on enterAnIntegerWithRange(thePrompt, defaultAnswer, lowRange, highRange)
tell application "QLab"
set theQuestion to ""
repeat until theQuestion is not ""
set theQuestion to text returned of (display dialog thePrompt with title dialogTitle default answer defaultAnswer buttons {"Cancel", "OK"} ¬
default button "OK" cancel button "Cancel")
try
set theAnswer to theQuestion as integer
if theAnswer < lowRange or theAnswer > highRange then
set theQuestion to ""
end if
on error
set theQuestion to ""
end try
end repeat
return theAnswer
end tell
end enterAnIntegerWithRange
on enterATimeWithCustomButton(thePrompt, defaultAnswer, customButton)
tell application "QLab"
set theQuestion to ""
repeat until theQuestion is not ""
set theResult to (display dialog thePrompt with title dialogTitle default answer defaultAnswer ¬
buttons customButton & {"Cancel", "OK"} default button "OK" cancel button "Cancel")
set theQuestion to text returned of theResult
set theButton to button returned of theResult
if theButton is (customButton as string) then
set theAnswer to theButton
exit repeat
end if
try
set theAnswer to theQuestion as number
if theAnswer is less than 0 then
set theQuestion to ""
end if
on error
if theQuestion contains ":" then
try
set currentTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set theMinutes to word 1 of theQuestion
set theSeconds to rest of words of theQuestion as string
set AppleScript's text item delimiters to currentTIDs
set theAnswer to (theMinutes as number) * 60 + (theSeconds as number)
on error
set theQuestion to ""
end try
else
set theQuestion to ""
end if
end try
end repeat
return theAnswer
end tell
end enterATimeWithCustomButton
on enterARatio(thePrompt, defaultAnswer)
tell application "QLab"
set theQuestion to ""
repeat until theQuestion is not ""
set theQuestion to text returned of (display dialog thePrompt with title dialogTitle default answer defaultAnswer ¬
buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel")
try
set theAnswer to theQuestion as number
if theAnswer ≤ 0 then
set theQuestion to ""
end if
on error
set theQuestion to ""
end try
end repeat
return theAnswer
end tell
end enterARatio
on enterANumber(thePrompt, defaultAnswer)
tell application "QLab"
set theQuestion to ""
repeat until theQuestion is not ""
set theQuestion to text returned of (display dialog thePrompt with title dialogTitle default answer defaultAnswer buttons {"Cancel", "OK"} ¬
default button "OK" cancel button "Cancel")
try
set theAnswer to theQuestion as number
on error
set theQuestion to ""
end try
end repeat
return theAnswer
end tell
end enterANumber
-- Subroutines: output
-- This subroutine was written with help from http://www.fluther.com/disc/22258/applescript-get-and-reformat-current-date-then-insert-it-in-any/
on grabCurrentTimeYYMMDDHHMMSS()
set currentTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to "" -- Can't assume this!
set {year:y, month:m, day:d, time string:t} to (current date)
set dateString to (y * 10000 + m * 100 + d) as string
set timeString to (t) as string
set theTime to ¬
(text items 3 thru 4 of dateString) & "-" & ¬
(text items 5 thru 6 of dateString) & "-" & ¬
(text items 7 thru 8 of dateString) & " " & ¬
(text items 1 thru 2 of timeString) & ¬
(text items 4 thru 5 of timeString) & ¬
(text items 7 thru 8 of timeString)
set AppleScript's text item delimiters to currentTIDs
return theTime as string
end grabCurrentTimeYYMMDDHHMMSS
on startTheClock()
tell application "QLab"
display dialog "One moment caller..." with title