Skip to content
AppleScript integration for Org Babel
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.org
ob-applescript.el

README.org

AppleScript integration for Org Babel

This module lets you run AppleScript from AppleScript source code blocks with Org Babel.

This package is a direct result of attempting to answer a question on this emacs.stackexchange.com thread.

Some simple examples

No arguments, no code – just return a string.

#+BEGIN_SRC applescript
  "Hello World"
#+END_SRC

#+RESULTS:
: Hello World

You can, however, pass a variable to a block:

#+BEGIN_SRC applescript :var subject="World"
  "Hello " & subject
#+END_SRC

#+RESULTS:
: Hello World

You can use either apples or applescript as the language designation, to cater for two popular major modes. Use whichever you like. I prefer the font-locking of the apples one. This example also shows you can do interactive stuff.

#+BEGIN_SRC apples
display alert "Danger! The WHAM is overheating!"
#+END_SRC

#+RESULTS:
: button returned:OK

If the result of the evaluation looks like a table, it’ll become a table:

#+BEGIN_SRC apples
"fi fo
1 2
3 4"
#+END_SRC

#+RESULTS:
| fi | fo |
|  1 |  2 |
|  3 |  4 |

Installation

M-x package-install RET ob-applescript RET

Then, load the package from your ~/.emacs.d/init.el:

(require 'ob-applescript)

Ideas for future work (you’re welcome to help!)

  • osascript supports an interactive mode, which means I think it should be possible to support :session.
  • Adding some tests.
  • Adding some more documentation & examples.
You can’t perform that action at this time.