Skip to content

Instantly share code, notes, and snippets.

@jonathanstiansen
Created November 4, 2015 03:24
Show Gist options
  • Save jonathanstiansen/83bdd6f9cc2297f1e9ad to your computer and use it in GitHub Desktop.
Save jonathanstiansen/83bdd6f9cc2297f1e9ad to your computer and use it in GitHub Desktop.
This is how one
// Examples are: "tell application \"Google Chrome\" to return URL of front document"
// Other web app specific versions here: https://gist.github.com/vitorgalvao/5392178
let myAppleScript = "..."
var error: NSDictionary?
if let scriptObject = NSAppleScript(source: myAppleScript) {
if let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(&error) {
if let result = output.stringValue {
print(output.stringValue)
}
} else if (error != nil) {
print("error: \(error)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment