AppleScript入门

编辑器:AppleScript Editor

这位仁兄写的入门文章还不错:http://bukkake.iteye.com/blog/828322,就不重复了。

下面补充一点别的

AppleScript的后缀名为.scpt,可以将编写好的.scpt导出为几种格式:.applescript(Text), .app(Application), .scptd(script bundle),都有什么用呢?

.scptd(script bundle):像Mac上其他的bundle一样,是一个压缩包,包含scpt文件和其他的声音、图片等资源。双击后打开AppleScript Editor

.app(Application):也是一个bundle,区别就是它已经是一个app了,双击就运行。

.applescript(Text):就是文本文件了,没啥好说的。双击后打开AppleScript Editor

.scpt:不要以为用Editor编写完直接保存的.scpt文件一定是文本文件,.scpt不是文本文件,而是被编译后的文件。双击后打开AppleScript Editor

下面是官方对此的描述:

AppleScript 1.9.2 supports a new bundled format for compiled scripts and script applications (applets) that uses standard Mac OS X bundles. Compiled script bundles have the filename extension ".scptd", while applet bundles have the filename extension ".app". 

Scripting additions can be embedded within bundled applets by placing them in a folder named Scripting Additions inside the bundle's Contents/Resources/ folder. Note that Script Editor does not look for embedded scripting additions when editing bundled applets. Any required scripting additions must be properly installed in the normal locations during script development so that Script Editor can find them.

还有啥是bundle,给我等小白看的:

A bundle is a bundle. A "folder" where you can find the usual stuff: a "Info.plist" file containing info about the bundle (the app), a "PkgInfo" file containing the file and creator type of the bundle, a "MacOS" folder containing an executable archive and a "Resources" folder, where you keep all other stuff: icons, scripts, scripting additions, localizable files, etc. 

原文地址:https://www.cnblogs.com/whyandinside/p/3052767.html