in scripting bridge how can i send shortcut with 2 modifiers?

坚强是说给别人听的谎言 提交于 2019-12-23 05:32:38

问题


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...



来源:https://stackoverflow.com/questions/3886214/in-scripting-bridge-how-can-i-send-shortcut-with-2-modifiers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!