Re: [QLab] collapse Group ...

490 views
Skip to first unread message

Jeremy Lee

unread,
Jan 25, 2013, 9:09:44 AM1/25/13
to ql...@googlegroups.com
Pretty sure you don't need the "tell application" commands when it's in an Applescript cue.

On Jan 24, 2013, at 6:45 PM, mathias halén <mathia...@gmail.com> wrote:

Hi I'm trying to get a Script working where i'm collapsing the map of the previous map.
I got it to work from applescript editor but not form inside Qlab. Does any one know why?


tell application "QLab"
set mySel to selected of workspace 1
set originalCue to last item of mySel
tell workspace 1
-- Select Current Cue
set playback position of current cue list to cue 1 of current cue list
-- Go to Q and close MAP 
tell application "System Events"
activate application "QLab"
delay 0.25 -- Wait for Double GO Protection to pass
key code 123
delay 0.25 -- Wait for Double GO Protection to pass
end tell



--
--
Change your preferences or unsubscribe here:
http://groups.google.com/group/qlab
 
Follow Figure 53 on Twitter: http://twitter.com/Figure53
 
 
 

-- 
Jeremy Lee
    Sound Designer, NYC - USA 829


mathias halén

unread,
Jan 26, 2013, 4:52:10 AM1/26/13
to ql...@googlegroups.com
still didn't get it to work with our without the tell application "Qlab". It almost work when i use the tell application. the only thing the script isn't doing it the keycode event. but the keycode event is working if I use the applescript editor. So can Qlab use keycodes? 
Message has been deleted

Rich Walsh

unread,
Jan 26, 2013, 1:21:00 PM1/26/13
to ql...@googlegroups.com
On 26 Jan 2013, at 09:52, mathias halén <mathia...@gmail.com> wrote:

> still didn't get it to work with our without the tell application "Qlab". It almost work when i use the tell application. the only thing the script isn't doing it the keycode event. but the keycode event is working if I use the applescript editor. So can Qlab use keycodes?
>
> On Friday, January 25, 2013 3:09:44 PM UTC+1, Jeremy Lee wrote:
> Pretty sure you don't need the "tell application" commands when it's in an Applescript cue.
>
> On Jan 24, 2013, at 6:45 PM, mathias halén <mathia...@gmail.com> wrote:
>
>> Hi I'm trying to get a Script working where i'm collapsing the map of the previous map.
>> I got it to work from applescript editor but not form inside Qlab. Does any one know why?
>>
>>
>> tell application "QLab"
>> set mySel to selected of workspace 1
>> set originalCue to last item of mySel
>> tell workspace 1
>> -- Select Current Cue
>> set playback position of current cue list to cue 1 of current cue list
>> -- Go to Q and close MAP
>> tell application "System Events"
>> activate application "QLab"
>> delay 0.25 -- Wait for Double GO Protection to pass
>> key code 123
>> delay 0.25 -- Wait for Double GO Protection to pass
>> end tell

I can't tell for sure from the script what you're even _trying_ to achieve. I guess you started from http://wiki.figure53.com/QLab+Scripts+and+Macros#x-General-Preview%20selected%20&%20move%20down, which – 3 years on – I can make do this:

tell application "System Events"
key code 126 -- Up arrow
key code 123 -- Left arrow
key code 123 -- Left arrow
key code 123 -- Left arrow
key code 125 -- Down arrow
end tell

On a Hot Key, this has the effect of going to the previous cue and collapsing it if it is an expanded Group Cue, before moving back down to the current cue. The left-arrow command you are using only works on the _selected_ cue, so this will all happen _independently_ of the playback position, unless you have "Playback position is always the selected cue" on.

It turns out you don't need to activate QLab (it's already active), you don't need to wait for double GO (it doesn't intercept Hot Key triggers, I think), you don't need "Enable access for assistive devices" switched on, and you can use key codes _or_ key commands (ASCII characters 27-31 for left, right, up, down).

I have no idea why you would want to do this or how you are planning to call this script, ie: Hot Key, or programmatically? If you pop it in a Group Cue (or use a Start Cue targeting a single instance of the Script Cue in several Group Cues), AND have "Playback position is always the selected cue" on, then when you GO the Group Cue it collapses as the next cue stands by. This is rather disconcerting for an operator, and when you are already having to allow for the fact that the screen often doesn't update fast enough to reassure you that a cue has fired (eg: while a large preload is taking place, the playback position doesn't move down when you GO), I personally would hate this extra visual disturbance.

The script you have posted doesn't do anything useful for me in either AE or QLab:

• It is missing two lines and therefore won't compile
• Why go to the trouble of getting the variable originalCue when you don't use it again, and only ever target the first cue in the current cue list with the playback position move?
• Why move the playback position when the left-arrow command only works on the selected cue? Are you trying to move the selection to the cue before the last selected cue – in which case, don't you also need to move it back again?
• What is a "MAP"?
• You genuinely don't need to tell QLab from within itself; that line doesn't do anything

Your script _does_ collapse the _first cue in the current cue list_ IF you preview it, but not if you GO it. This is because, when GOing, QLab fires the cue (which moves the playback position via the script), then stands by for the next cue (which automatically moves the playback position down another cue) and THEN – after your delay – the left-arrow command arrives and affects the next cue in the list!

Trying to move the selection to the cue before is only going to work if "Playback position is always the selected cue" is on (as you can only move playback position), and, what's more, you are entering a world of pain trying to do this as there is no easy way of querying "cue before selected in current cue list". You would have to get the id of the current cue, a list of the ids of all the cues in the cuelist, crunch through the list until you found a match, get the id of the item in the list before the one you just found and then set the playback position to this… Of course, you'd then only need to send the left-arrow command once as you'd know for sure you hadn't moved onto a child of a Group Cue (only the Group Cues themselves are cues of the the current cue list).

Also bear in mind that there are significant differences in scripting behaviour between Snow Leopard, Lion and Mountain Lion. For example, when originally writing all my stuff in Snow Leopard (or possibly even Leopard), QLab didn't automatically coerce "selected" to a list when queried (hence all the "(selected as list)" phrases); however, with QLab 2.3.8 and Mac OS X 10.8.2, it miraculously DOES not pass selected as a list when queried! This is the combination of software I have been used to look at your problem; if you are using a different combination, you may well get different results…

Rich

[Sorry if this appears a few times; it seems to get stuck for some reason. I tried posting it online, but Google promptly deleted it! Maybe plain text will get through?]

mathias halén

unread,
Jan 27, 2013, 4:25:32 AM1/27/13
to ql...@googlegroups.com
All i was trying for was Collapsing the previews Group Cues. And it seams to be ass simple as the script you shows me:

 
tell application "System Events" 
                key code 126 -- Up arrow 
                key code 123 -- Left arrow 
                key code 123 -- Left arrow 
                key code 123 -- Left arrow 
                key code 125 -- Down arrow 
        end tell 

So Thank you this works exactly the way i waned it to.
Reply all
Reply to author
Forward
0 new messages