Post

Replies

Boosts

Views

Activity

Reply to How do I run AppleScript Safely inside my Swift app?
Hi @konradedgar & eskimo. I am still running into issues regarding permissions and still receive -600 "The application is not running" error. Can confirm I have Hardened Runtime enabled with Apple Events, and added the NSAppleEventsUsageDescription. The script I am trying to execute is quite simple and works when running it in the AppleScript app. Any recommendations...? Also curious about the answers to @konradedgar follow up questions! Swift func openTrashDirectory() { let script = """ tell application "Finder" open trash activate end tell """ DispatchQueue.main.async { var error: NSDictionary? if let scriptObject = NSAppleScript(source: script) { scriptObject.executeAndReturnError(&error) if let error = error { print("Error: \(error)") } } } }
Oct ’24