Will - here is a script which I think will do what you want. Grabs the clasped time of (last) running group cue, creates a midi cue, moves into into the group and set the pre-wait. Don't know the details of what MIDI (voice, MSC, SysEx) message you need, so you will have to modify that bit to suit your application. When running unattended I always think it is useful to log things, so if things don't work as intended you have some info to try and debug it - but that would add more complexity than I want to include here. The script uses notifications to let the user know something is happening without being too intrusive.
(sorry I can't get this is nicely format as Mic has done, even though I'm using Safari browser)
-- make midi cue with pre wait
-- change these midi parameters to suit
set MIDIpatchNum to 1
set MIDIchannel to 1
set midiSysExMessage to "B0 69 00 B0 76 21"
-- TODO for an unattended installation useful to log to file so can review problems
set nl to linefeed
tell application id "com.figure53.QLab.5" to tell front workspace
try
set runningGroupCue to last item of (every cue whose (running is true) and (q type is "Group"))
set elapsedtime to (action elapsed of runningGroupCue) as real
on error ErrorMessage
display notification ErrorMessage & nl & "no running group cue?" with title "Error"
return
end try
make type "midi"
set midiCue to last item of (selected as list)
set notes of midiCue to "created at " & (current date)
-- set other midi cue parameters here
-- MIDI cue parameters
set midi patch number of midiCue to MIDIpatchNum
set channel of midiCue to 1
-- MIDI types can be Voice (note, CC, Prog Change etc), MSC (MIDI Show Control) or SysEx (System Exclusive)
set message type of midiCue to sysex
-- there are lots of different midi parameters you can set, depending on your application
-- and you may want to modify the message / midi bytes here depending on some criteria
set sysex message of midiCue to midiSysExMessage
try
-- move cue into group and set prewait
move cue id (uniqueID of midiCue) of parent of midiCue to beginning of runningGroupCue
set pre wait of midiCue to elapsedtime
display notification " in group " & (q display name of runningGroupCue) & " with pre wait of " & elapsedtime & " Sys Ex message " & midiSysExMessage with title "Made MIDI Cue"
on error ErrorMessage
display notification ErrorMessage with title "Error"
end try
end tell