"Type Keystroke" does not work

Hi,

after a while I am turning back to Keyboard Maestro - I got attracted by @MacSparky doing his Window Management with KM. But right at that start I am having an issue and cannot get ahead with it :frowning:

I am using two monitors but I also want to open additional Desktops to arrange applications. For opening new Desktops I have found a little Apple script routine, which works fine:

do shell script "open -a 'Mission Control'"
delay 0.5
tell application "System Events" to click ( every button whose value of attribute "AXDescription" is "add desktop") of group 2 of group 1 of group 1 of process "Dock"
delay 0.5
tell application "System Events" to key code 53

So I am executing the AppleScript and then I want to move right to the next Desktop and do some stuff there:

Release the ⌃Right Arrow Keystroke

However, it does not go to the new Desktop - it just beeps and does nothing - what am I doing wrong, here ?

Thanks a lot for any help!

Does this work for you?

tell application "System Events" 
    key code 124 using {control down, option up, command up}
end tell
1 Like

There may be a bug either in MacOS or KM:

1 Like

Thank you, that works perfectly with the control down option … a bit short-sighted from me not to use that workaround from the start :wink:

That’s exactly the situation - I have not found this in the forum, though, thanks for pointing it out!