When I run an embedded Applescript I get the following error:
2022-08-02 23:12:02.856 hazelworker[57163] Invoice-36323-R (for testing Hazel).pdf: Rule Receipt expenses matched.
2022-08-02 23:12:02.881 hazelworker[57163] [Error] AppleScript failed: Error executing AppleScript on file /Users/ak/Downloads/Invoice-36323-R (for testing Hazel).pdf.
2022-08-02 23:12:02.881 hazelworker[57163] OSAScript error: {
NSLocalizedDescription = "No user interaction allowed.";
NSLocalizedFailureReason = "No user interaction allowed.";
OSAScriptErrorAppAddressKey = "<NSAppleEventDescriptor: [0x0,2 \"hazelworker\"]>";
OSAScriptErrorAppNameKey = Hazel;
OSAScriptErrorBriefMessageKey = "No user interaction allowed.";
OSAScriptErrorMessageKey = "No user interaction allowed.";
OSAScriptErrorNumberKey = "-1713";
OSAScriptErrorRangeKey = "NSRange: {0, 0}";
}
2022-08-02 23:12:02.884 hazelworker[57163] Done processing folder Downloads
The applescript is:
set theAttachment to (POSIX path of theFile)
set theSubject to "LayerStack invoice to Expensify"
set theContent to "This is an automated email using Hazel."
set theAddress to "a@aol.com"
display dialog "theAttachment"
tell application "Mail"
activate
set newMessage to make new outgoing message with properties {subject:theSubject, content:theContent & return & return}
tell newMessage
set visible to false
set sender to "a@mac.com"
make new to recipient at end of to recipients with properties {address:theAddress}
make new attachment with properties {file name:theAttachment} at after the last paragraph
send -- use save to draft or send to send
end tell
end tell
Any help appreciated to understand where to look and how to resolve.