我需要能够通过Keymando强制“检测显示”。我没有看到任何关于如何执行系统命令的示例。对如何做到这一点有什么想法吗?
发布于 2012-07-18 14:13:02
多亏了Kevin和这个article,我用这个脚本让它工作起来了。希望这对将来的人有所帮助。
# Detect Displays
map "<Cmd-Ctrl-d>" do
`osascript -e '
tell application "System Preferences" to activate
tell application "System Events"
tell process "System Preferences"
click menu item "Displays" of menu "View" of menu bar 1
tell button "Detect Displays" of window 1 to click
end tell
end tell
tell application "System Preferences" to quit
'`
end发布于 2012-07-17 00:13:13
您可以像在ruby中一样使用反引号或system()来完成此操作。
例如:
map "<Ctrl-u>" do
`osascript -e 'set volume output volume (output volume of (get volume settings) + 7)'`
endhttps://stackoverflow.com/questions/11508017
复制相似问题