help scripting simultaneous keystrokes

Discussion in 'Mac Programming' started by Addo, May 2, 2018.

  1. Addo macrumors member

    Jan 11, 2006

    At work, I use a video switcher and there is a companion app that I use to control it. Within the app there are quite a few commands that have keyboard shortcuts, it's these shortcuts that I am trying to replicate on an Elgato Stream Deck ( sort of a programmable keyboard )

    The problem is that many of these shortcuts require simultaneous keystrokes i.e to recall Preset 1 requires "m" AND "1" to be pressed at the same time. The Stream Deck can only learn a single keystroke ( although it does recognise modifier keys if pressed).

    I figured that as the Stream Deck can be set to trigger scripts I thought I'd attempt to use AppleScript to fire off these keystrokes - thats where I need help. If I use the following:

    tell application "System Events"
        key code {46, 19}
    end tell

    I was hoping it would fire "m" and "1" simultaneously, but it it fires the keys sequentially and as such isn't recognised by the app.

    Any pointers in how to accomplish this? I'm very much a noob when it comes to scripting....
  2. Red Menace macrumors 6502

    Red Menace

    May 29, 2011
    Littleton, Colorado, USA
    Regular AppleScript can't perform simultaneous key presses like that - the keystroke and key code commands will only press a single key (with optional modifier keys) at a time.

Share This Page