2012-07-16 68 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

相關問題