in scripting bridge how can i send shortcut with 2

2019-06-13 08:19发布

问题:

I was trying to replicate "take a screenshot shortcut" (cmd+shift+3) via cocoa and scripting bridge

SystemEventsApplication * sysEvent = [SBApplication applicationWithBundleIdentifier:@"com.apple.systemevents"];
[sysEvent keyCode:20 using:SystemEventsEMdsCommandDown];

but i can't send more than one SystemEventsEMds to the method.
In applescript is as easy as

key code 20 using {command down, shift down}

回答1:

I kinda solved this. I was trying to get a cmd+shift+3 that serves, as all of you know, to take a screenshot. shift+3 is in the italian keyboard = to "£" so

[sysEvent keystroke:@"£" using:SystemEventsEMdsCommandDown];

does the trick I'm still wondering how would i have done with a cmd+opt+something and how to manage localization...