[macOS笔记]AppleScript综述

140 阅读2分钟

AppleScript简介

Wiki:en.wikipedia.org/wiki/AppleS…

Apple官方存档:developer.apple.com/library/arc…

AppleScript书籍:

AppleScript社区

AppleScript工具

AppleScript资讯

AppleScript示例

AppleScriptObjc

John C. Welch: "对于 ASOC 用户:如果您将 Xcode 13.x 中的 /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Project Templates/macOS/Other/AppleScrip App.xctemplate 复制到 /Applications/Xcode-beta.app/Contents/Developer/Library/Xcode/Templates/Project Templates/Other/,那么您仍然可以使用 Xcode 14 beta 创建 ASOC 应用程序"。

Stay-open Appliction

官方文档:idle and quit Handlers for Stay-Open Applications

my addObserver:me selector:"appLaunchNotification:" |name|:(current application's NSWorkspaceDidLaunchApplicationNotification) object:(missing value)
on run
	set theEventStore to ca's class "EKEventStore"'s new()
	ca's NSNotificationCenter's defaultCenter()'s addObserver:me selector:"eventStoreChanged:" |name|:"EKEventStoreChangedNotification" object:theEventStore
end run
$.NSWorkspace.sharedWorkspace.notificationCenter.addObserverSelectorNameObject(controller, 'appDidLaunch:', $.NSWorkspaceDidLaunchApplicationNotification, undefined)

AppleEvent简介

官方文档:Scripting Bridge

Scripting Addition简介

Apple官方文档:

其他:

A scripting addition on Mac OS 9 is a resource file of type 'osax‘. On Mac OS X it can also be a bundle with extension .osax. A scripting addition is often referred to as an osax (plural osaxen). On Mac OS 9, osaxen live in the System Folder, in its Scripting Additions subfolder. On Mac OS X the supplied osaxen live in /System/Library/ScriptingAdditions; the user may add osaxen to /Library/ScriptingAdditions or to ~/Library/ScriptingAdditions, according to the domain of their desired availability.

AppleScript的问题