Simulating Keystroke CMD-[ in Canva

Hello!

I am trying to create a macro that simulates cmd [, but my keyboard is in Spanish, so to type [ I have to use shift { to get a [. So that means that I cannot get cmd [ directly on my keyboard.

I have tried having my keyboard layout in US, where you can get a [ without modifiers, and as soon as I shift back to Spanish layout, KM changes the macro to cmd ?.

image

Is there a way to simulate the keystroke cmd [ ?

I have tried AppleScript, but it does not work, maybe there is a syntax error or needs to escape the character somehow?

tell application "Keyboard Maestro Engine"
  keystroke "[" using command down
end tell

Can someone help me, please? Thanks! :blush:

Try ⌘⇧{

Generally you do the keystroke just as you would type it for your language/keyboard settings.

1 Like

Nope, tried that before and it is not working. It is not taking it as [, but it is taking it as { with double modifier :confused:

@peternlewis?

Do you mean "Spanish - Latin American"?

What software are you trying to use the macro in? The following works for me in BBEdit, doing "Shift Left" on an indented line:

image

...where the menu command shortcut is ⌘[

Simulated Keystrokes are based on key codes, together with modifiers.

So asking to to simulate a key that isn't on the keyboard, or in a way that can't be typed from the keyboard, doesn't make sense in the context of the action - if simulates based on a keycode, the current language does not affect what it does (it can affect what is displayed in the action editor).

1 Like

I'm doing that on Canva. Whenever I press ⌘⇧{ it does something else. So, it is not taking it.

So, is there a way to get the keycode of [ directly and add it on an AppleScript?

So far, what I have done on the macro, is pressing the keyboard shortcut to change from Latin American Spanish to US, then do the ⌘[ and then switch back the language. Is kind of ugly, but works so far.

A free tool every Mac user should have:

3 Likes

Isn't Canva a web app? in which case, all bets are off with respect to keystrokes aimed at the app (rather than the containing browser). You may have to look at sending JavaScript events to the page, or using KM's (very good) image-based actions.

1 Like

Its a web app but also an app itself. So, even changing layouts is not working now lol. So yeah, seems that image-based actions would be the way to do it. Thanks!

(Does quick web search and download...)

It's an Electron app -- basically a web app with its own Chromium engine included. So all bets are still off, I'm afraid...

But now I've got it I might as well have a poke, just in case :wink:

Can you confirm which keyboard/language you're using? Easiest way is "Show Keyboard Viewer" and take a screenshot.

1 Like

Thanks! Is this what you need?

Yep, that's great.

I think you're still out of luck, though. With "Spanish - Latin American" keyboard settings I'm finding that ⌘´ (the [ key on a UK keyboard, as the stated shortcut) works to send an object one layer back, ⌘⌥´ all the way to the back, ⌘⌥+ (the ] key on a UK keyboard) all the way to the front, but ⌘+ -- which should be "one layer forward" -- simply doesn't work.

You could try every possible key/modifier combo in case you can find one that does work, then remap that via a KM macro, but that's likely an unreliable solution. I'm afraid I'm completely out of ideas...

Thanks a lot for your help! :blush: I also arrived to the same thing, where it works using the code for bringing an object back, but not forward :pensive: Thanks for taking the time to try it!