Skip to content

Instantly share code, notes, and snippets.

@edgargoncalves
Created June 18, 2010 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgargoncalves/443517 to your computer and use it in GitHub Desktop.
Save edgargoncalves/443517 to your computer and use it in GitHub Desktop.
(ns clj-as.core
(:import [javax.script.ScriptEngine]
[javax.script.ScriptEngineManager]
[javax.script.ScriptEngineException]))
(defn order-itunes-to [command]
(let [mgr (javax.script.ScriptEngineManager.)
engine (.getEngineByName mgr "AppleScript")]
(.eval engine (str "tell application \"iTunes\" to " command))))
;;; Use it like this:
;; (order-itunes-to 'play)
;; (order-itunes-to 'stop)
;; ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment