I've just made `ob-applescript', a backend to execute AppleScript from
Org Babel source code blocks available on Melpa. It's my first attempt
at making a babel backend, so any comments and criticism welcome. Here
are some things it does support though:
- No arguments, no code – just return a string.
#+BEGIN_SRC applescript
"Hello World"
#+END_SRC
#+RESULTS:
: Hello World
- You can pass 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 competing major modes. 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 |
Hope this is useful to someone!
Stig