2012-07-16 32 views

回答

0

感谢凯文,这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 
2

你可以像使用反引号或system()一样在ruby中做同样的事情。

例如:

map "<Ctrl-u>" do 
    `osascript -e 'set volume output volume (output volume of (get volume settings) + 7)'` 
end 
+0

感谢您的'osascript提示凯文是强大的 – Adam 2012-07-18 06:13:38