I'm hoping someone could help me write a script that will copy the cue
name of the first child of a group cue to the cue name of the group
cue. All of my cue's are in group cues. I have tried UI Scripting, but
it seems to work 5 times out of ten and I'm looking for a more elegant
solution.
Here's the UI script I came up with:
tell application "System Events"
tell process "QLab"
key code 125
delay 0.1
keystroke "q"
delay 0.1
keystroke "c" using {command down}
delay 0.1
key code 36
delay 0.1
key code 126
delay 0.1
keystroke "q"
delay 0.1
keystroke "v" using {command down}
delay 0.1
key code 36
end tell
end tell
Much appreciated if someone could help me out!
--Adam
________________________________________________________
WHEN REPLYING, PLEASE QUOTE ONLY WHAT YOU NEED. Thanks!
Change your preferences or unsubscribe here:
http://lists.figure53.com/listinfo.cgi/qlab-figure53.com
Follow Figure 53 on Twitter here: http://twitter.com/Figure53
> Hi All,
>
> I'm hoping someone could help me write a script that will copy the cue
> name of the first child of a group cue to the cue name of the group
> cue. All of my cue's are in group cues. I have tried UI Scripting, but
> it seems to work 5 times out of ten and I'm looking for a more elegant
> solution.
>
> Here's the UI script I came up with:
In the words of the Librarian: "Oook!". UI scripting is the last resort for when all else fails (and then it also fails too, more often than not...). There are built in ways of achieving what you want in QLab's AppleScript dictionary:
tell front workspace
set selectedCue to last item of (selected as list)
if q type of selectedCue is "Group" then
set firstName to q name of first item of cues of selectedCue
set q name of selectedCue to firstName
end if
end tell
You'd save that as a Script Cue with a Hot Key trigger.
If you want to get fancy and have the Script Cue work even if you don't have one of the Group Cue's children selected:
tell front workspace
set selectedCue to last item of (selected as list)
if q type of selectedCue is "Group" then
set groupCue to selectedCue
else
set groupCue to parent of selectedCue
end if
if mode of groupCue is not cue_list then
set firstName to q name of first item of cues of groupCue
set q name of groupCue to firstName
end if
end tell
You could add a repeat loop to process all the Group Cues instead of just the selected one if you want.
_Much_ more info here:
http://wiki.figure53.com/QLab+Scripts+and+Macros
Rich
As always you are amazing!
I see it now! The problem I was having before udon UI Scripting was
how to reference the first child. It makes sense now! I'll play around
with both to see which one will work the best, but my guess is it'll
probably be the second one!
Thanks a bunch Rich!
--Adam