I have a simple AppleScript that sends an email. How can I call it from within a Swift application?
(I wasn\'t able to find the answer via Google.)
You can try NSAppleScript, from Apple's Technical Note TN2084 Using AppleScript Scripts in Cocoa Applications https://developer.apple.com/library/mac/technotes/tn2084/_index.html
NSAppleScript* scriptObject = [[NSAppleScript alloc] initWithSource:
@"\
set app_path to path to me\n\
tell application \"System Events\"\n\
if \"AddLoginItem\" is not in (name of every login item) then\n\
make login item at end with properties {hidden:false, path:app_path}\n\
end if\n\
end tell"];
returnDescriptor = [scriptObject executeAndReturnError: &errorDict];