osa
osa copied to clipboard
Emacs Lisp to Open Scripting Architecture (AppleScript / JavaScript) bridge
[[https://opensource.org/licenses/BSD-2-Clause][https://img.shields.io/badge/license-BSD-blue.svg]] [[https://melpa.org/#/osa][https://melpa.org/packages/osa-badge.svg]]
osa.el is an Emacs Lisp to macOS Open Scripting Architecture bridge (JavaScript / AppleScript) working on top of Apple Event descriptors as provided by Emacs Mac port.
- Features All of the necessary Apple Event types that are needed to write useful scripts are supported for both packing and unpacking:
- True is unpacked to t
- False is unpacked to nil
- Boolean is unpacked to t or nil
- Long is unpacked from signed 32bit to Emacs Lisp integer
- Null which is distinct from null type, is unpacked to keyword :null
- Type is unpacked to either (:type :null), (:type :msng), (:type data)
- Unicode text (UTF-16 BOM auto-detection)
- List is unpacked to Emacs Lisp vector
- Record is unpacked to an Emacs Lisp tagged alist: (:reco (k . v) ..)
Conversely for packing, except t and nil are always packed to True and False (never a Boolean type) and tagged (:list ..) is packed like a vector.
Additional types may be implemented in future releases.
- Note Does not work with official GNU Emacs for macOS (or emacsformacosx.com) as it does not expose an Apple Event API.
You need Yamamoto Mitsuharu's excellent [[https://bitbucket.org/mituharu/emacs-mac][Emacs Mac port]], which can also be found in MacPorts and Homebrew, though cloning its repository and building from source is highly recommended.
- Install Simple and most flexible method:
#+BEGIN_SRC emacs-lisp ;; Clone this repository, ensure directory of osa.el is in your ;; load-path and add the following to your init file: (require 'osa-examples) #+END_SRC
Alternatively, you can install through [[https://melpa.org/][MELPA]] or some other Emacs package manager.
-
Usage See osa-examples.el
-
License This repository uses 2 different licenses:
- All files in the 'scripts' directory use a public-domain equivalent license
- All other files use a 2-clause BSD license
- Author xristos (AT) sdf (DOT) org