Skip to content

hakanserce/ob-applescript.el

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

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.

About

AppleScript integration for Org Babel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 100.0%