JCAppleScript

MIT License
Objective-C
macOS

1 image

Author

Description

A simple, helpful library for using your Objective-C variables within a bundled AppleScript or OSAScript.

Apple provides NSAppleScript and OSAKit for executing AppleScript in Cocoa, but there is no clear way to execute a script with variables from your Objective-C code, unless you do a long-ass [NSString stringWithFormat:]

JCAppleScript attempts to provide a simple, sane way of adding AppleScript files to you App bundle and executing them while optionally inserting your Objective-C variables into the script before executing.

Example Usage:

In MyScript.scpt

tell application "Finder"
    display dialog $0 $1
end tell
In Your Objective-C Class

NSArray *myVariables = [NSArray arrayWithObjects:@"Hello", @"World", nil];
[JCAppleScript runAppleScript:@"MyScript" withVariables:myVariables;

Tags