Applescript API documentation

前端 未结 4 1069
既然无缘
既然无缘 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 22:52

    Ok this is how it works:

    Where is the documentation that tells me, for instance, tha the System Preferences object is actually called "System Preferences"

    The object is called "System Preferences" because that is the exact name of the application. What you're telling Applescript with this is I want to speak to the application named System Preferences (tell application "System Preferences" ...)

    that it has objects called "pane"

    Now it's the fun part. If you open your Library window (in Applescript Editor, Window > Library) you will see that there is a collection of scriptable applications available, the thing is that 'System Preferences' is not there. So let's find it: File > Open Dictionary > System Preferences. Now you got a window that both lets you drill down all available classes/commands/properties of the app and also a split window with relevant documentation (if you click on SSystem Preferences you'll see Cpane and by clicking on this you'll see Pid among others). The id of the pane for once more would be the name of the pane (lowercased and concatenated - I'm still looking into documentation for a strict definition on this). I hope that this will get you started.


    S:Suite C:Class P:Property (the 'C' inside a circle stands for Command)

提交回复
热议问题