开发者

Deselecting default screen shots option using Apple Script

I am trying to make an apple script through which I can deselect this option:

System Preferences > Hardware > Keyb开发者_开发技巧oard > Keyboard Shortcuts > Screen Shots > Save picture of selected area as a file

Can anyone suggest me some sample script for it?

Thanks,

Miraaj


System Preferences are not scriptable by default. You will have to use GUI Scripting, but that will be a little bit different for everyone depending on what preferences they have installed. There is a an excellent example over at www.macosxautomation.com that will get you started.


I am a bit late to this but, here's what worked for me:

     tell application "System Preferences"
       --activate
       reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
     end tell

     tell application "System Events" to tell process "System Preferences"
        select row 4 of table 1 of scroll area 1 of splitter group 1 of tab group 1 of window 1
        repeat with r in rows of outline 1 of scroll area 2 of splitter group 1 of tab group 1 of window 1
          click checkbox 1 of UI element 1 of r
        end repeat
     end tell

     quit application "System Preferences"

Note this disable all checkboxes and not just "Save picture of selected area as a file". To disable just that replace the repeat block with:

click checkbox 1 of UI element 1 of row 4 of outline 1 of scroll area 2 of splitter group 1 of tab group 1 of window 1

You can enable or disable any other screenshot shortcut by replacing row 4 with the row number of the correct shortcut

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜