Applescript API documentation

前端 未结 4 1085
既然无缘
既然无缘 2021-01-02 22:19

I want to make an AppleScript to automate the task of switching resolution on the MacBook Pro Retina.

Searching the internet for \"applescript system preferences\" I

4条回答
  •  梦谈多话
    2021-01-02 23:01

    I have another issue but you can have a look to my question as there is some hint in my script about your issue

    HOW TO: display a check mark, disable a menu item, refresh a menubar

    For instance:

    tell application "System Preferences"
        reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
    end tell
    

    This code should directly put you in the resolution preferences of the system preference.

    Then you can make a code to recuperate all the UI elements of the pane so that you now which action to trigger. Something like this should also work:

    tell application "System Events"
    tell application process "System Preferences"
        set frontmost to true
        delay 1
        return every UI element of front window
        return name of every UI element of front window
    end tell
    

    end tell

    Hope it helps

提交回复
热议问题