AppleScript UI Scripting

264 views
Skip to first unread message

Alexander Taylor (Mailing List)

unread,
Jan 19, 2016, 8:20:35 PM1/19/16
to ql...@googlegroups.com
Hello all,

I’ve made some progress and have QLab scripting mostly working with Blackmagic Media Express. I’m using keyboard commands to switch to the correct pane and then start recording. It works as you would expect, but the commands get passed into QLab as well. So I get an empty audio cue added after I run this script cue. Does anyone have an idea on what I’m missing?

Thanks,
Alexander

> activate application "Blackmagic Media Express"
> tell application "System Events" to tell process "Blackmagic Media Express"
> keystroke "1" using {command down} -- Command-1
> end tell
> delay 5
> tell application "System Events" to tell process "Blackmagic Media Express"
> key code 15 using {command down} -- Command-r
> end tell

Rich Walsh

unread,
Jan 20, 2016, 6:45:04 AM1/20/16
to ql...@googlegroups.com
That implies the cmd-1 keystroke is hitting QLab not your other app. Is the other app running and becoming active fast enough? Are you running this script as a separate process? I'd recommend not, as you want QLab to wait for the script to finish before coming back into focus when you're throwing keystrokes around.

You don't need to tell processes about keystrokes: you only need to tell processes when scripting UI elements; keystroke and key code can be used directly (in the absence of anything in the language guide, this thread covers the basics pretty well: http://apple.stackexchange.com/questions/36943/how-do-i-automate-a-key-press-in-applescript). I guess keyboard interaction is sent to the active application, whereas clicking can be done on any process you can see, active or not.

Try this form and see if it helps:

tell application "Blackmagic Media Express"
activate
tell application "System Events"
keystroke "1" using {command down} -- Command-1
delay 5
key code 15 using {command down} -- Command-r
end tell
end tell

Are you 100% sure the pane switch is happening, and your other app doesn't just happen to be on the correct pane already? If the cmd-1 is sent before the other app activates – which it does during the delay – then this would create your phantom Audio Cue.

Rich

Alexander Taylor (Mailing List)

unread,
Jan 20, 2016, 9:47:22 AM1/20/16
to ql...@googlegroups.com
Here’s the strange part - the other program becomes active, and does the correct command-1 action.  QLab does it at the same time, in the background.  That’s what’s so confusing to me!

I can definitely see the pane switching, I’ll try your code and see how it goes.  As I said, the Media Express side works correctly, just don’t want QLab doing it in the background...

Thanks again,
Alexander

--
--
Change your preferences or unsubscribe here:
http://groups.google.com/group/qlab
 
Follow Figure 53 on Twitter: http://twitter.com/Figure53
---
You received this message because you are subscribed to the Google Groups "QLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qlab+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qlab/AD40CAF1-74A8-42BA-9687-72F2DB72E076%40mac.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Taylor (Mailing List)

unread,
Jan 20, 2016, 9:56:55 AM1/20/16
to ql...@googlegroups.com
Just tried that new code, worked quite well!

Thanks,
Alexander

crccpro...@gmail.com

unread,
May 11, 2017, 8:58:59 PM5/11/17
to QLab
Thia code works well to start the process....is the there one to stop the recording? and does anyone know how to automatically "keep" the existing file and not overwrite the recording?
Reply all
Reply to author
Forward
0 new messages