Quantcast
Viewing all articles
Browse latest Browse all 24

How to execute AppleScript from a Java or Scala application

If you ever need to execute AppleScript from a Java or Scala application, this code shows how to solve the programming part of this problem.

Given an AppleScript command as a Scala multiline string, like this:

    // press the `fn` key twice
    val asCommand = """
tell application "System Events"
    key code 63
    key code 63
end tell
"""

you can execute that command by calling this executeAppleScriptCommand method:

read more


Viewing all articles
Browse latest Browse all 24

Trending Articles