AppleScript的API文档 [英] Applescript API documentation

查看:619
本文介绍了AppleScript的API文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打一个AppleScript自动对MacBook Pro的视网膜分辨率切换任务。

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

搜索的AppleScript系统preferences网络我遇到的一个页面,其中一些preferences的表演。身为分辨率缩放新东西,它没有记录。

Searching the internet for "applescript system preferences" I came across a page where some preferences are show. Being the scaled resolution thing new, it is not documented.

这带来了一个更大的问题我有一个AppleScript的(记住,除了复制粘贴的东西我从来没有真的编程)。在哪里,告诉我,例如,塔系统preferences对象实际上是所谓的系统preferences,它有对象叫做窗格中的文档,他们有一个ID,而且暴露id是com.apple。preference.expose?

This brings to a bigger problem I have with AppleScript (mind that apart from copy-pasting something I never really programmed in it). Where is the documentation that tells me, for instance, tha the System Preferences object is actually called "System Preferences", that it has objects called "pane", that they have an id and that the expose id is "com.apple.preference.expose"?

好像必须有某种每个程序的秘密文件,而且必须是巨大的,所有映射的对象层次和可能采取的行动。最后,AppleScript的核心是最小的,你要做的就是操纵这种方案。但是,他们在哪里记录?

It seems like there must be some sort of "secret" documentation for every program, and they must be huge, mapping all the object hierarchies and possible actions. In the end, AppleScript core is minimal and all you do is manipulate such programs. But where are they documented?

推荐答案

确定这是如何工作的:

在哪里对象实际上是所谓的系统preferences,告诉我,比如文档,塔系统preferences

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

的对象称作系统preferences,因为这是应用程序的确切名称。什么你告诉AppleScript的这个是的我要发言给名为System preferences 的(告诉应用程序系统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"

现在是最有趣的部分。如果你打开​​你的库窗口(AppleScript的编辑器窗口>库),你会看到有脚本化应用程序中提供的集合,事情是,系统preferences'是不存在的。因此,让我们找到它:文件>打开字典>系统preferences。现在,你有一个窗口,既可以让你深入所有可用类/命令/应用程序与相关文件的属性,也是一个分割窗口(如果你点击<大骨节病>取值 系统preferences 你会看到<大骨节病> C 面板,并通过点击这个你会看到<大骨节病> P < /骨节病> ID )。窗格的一次的ID将是面板的名字(小写,然后连接起来 - 我还在寻找到文档以一个严格的定义)。我希望,这将让你开始。



<大骨节病>取值:套房
<大骨节病> C :类
<大骨节病> P :房产
(一圆圈内的C代表命令

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)

这篇关于AppleScript的API文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆