Can you execute an Applescript script from a Swift Application

As Kamaros suggests, you can call NSApplescript directly without having to launch a separate process via NSTask (as CRGreen suggests.) Swift Code let myAppleScript = “…” var error: NSDictionary? if let scriptObject = NSAppleScript(source: myAppleScript) { if let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError( &error) { print(output.stringValue) } else if (error != nil) { print(“error: \(error)”) } … Read more

Can the UI Automation instrument be run from the command line?

instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/\ PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \ <full_path_to_application> -e UIASCRIPT <path_to_script.js> \ -e UIARESULTSPATH <output_results_path> for xcode >= 4.5 instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/\ AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \ <full_path_to_application> -e UIASCRIPT <path_to_script.js> \ -e UIARESULTSPATH <output_results_path> for xcode >= 6.1 instruments -w <device ID> -t \ /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/\ AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate \ <full_path_to_application> -e UIASCRIPT <path_to_script.js> \ -e UIARESULTSPATH <output_results_path> There a few important … Read more