|
@@ -56,15 +56,23 @@ import Cocoa
|
|
|
make new to recipient at end of to recipients with properties {address:"\(contact)"}
|
|
|
tell content
|
|
|
"""
|
|
|
+
|
|
|
+// let errorDictionary: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
|
|
|
+// let emailScript = NSAppleScript(source: emailString + "end tell\nactivate\nend tell\nend tell")
|
|
|
+// let eventDescriptor = emailScript?.executeAndReturnError(errorDictionary)
|
|
|
+//
|
|
|
+// if eventDescriptor == nil {
|
|
|
+// if let url = URL(string: "https://www.pdfreaderpro.com/contact"), !NSWorkspace.shared.open(url) {
|
|
|
+// NSLog("Failed to open url: \(url)")
|
|
|
+// }
|
|
|
+// }
|
|
|
+ let workspace = NSWorkspace.shared
|
|
|
+ let service = NSSharingService(named: NSSharingService.Name.composeEmail)
|
|
|
|
|
|
- let errorDictionary: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
|
|
|
- let emailScript = NSAppleScript(source: emailString + "end tell\nactivate\nend tell\nend tell")
|
|
|
- let eventDescriptor = emailScript?.executeAndReturnError(errorDictionary)
|
|
|
+ service?.recipients = [contact]
|
|
|
+ service?.subject = subjects//emailString
|
|
|
+// service?.messageBody = emailString
|
|
|
|
|
|
- if eventDescriptor == nil {
|
|
|
- if let url = URL(string: "https://www.pdfreaderpro.com/contact"), !NSWorkspace.shared.open(url) {
|
|
|
- NSLog("Failed to open url: \(url)")
|
|
|
- }
|
|
|
- }
|
|
|
+ service?.perform(withItems: [""])
|
|
|
}
|
|
|
}
|