Hazel is watching a Dropbox folder and when a matching text file appears, it runs an embedded AppleScript that launches a Keyboard Maestro macro to use the contents of the text file to make a new Omnifocus project.
Here is the error in the log:
- Code: Select all
2024-03-15 11:13:20.521 hazelworker[25881] WHO372.txt: Rule New SDW Project matched.
2024-03-15 11:13:20.521 hazelworker[25881] Hazel Alert: WHO372.txt has arrived. HANDS OFF!
2024-03-15 11:13:20.521 hazelworker[25881] [Custom Message] Hazel Alert: WHO372.txt has arrived. HANDS OFF!
2024-03-15 11:13:20.609 hazelworker[25881] [Error] AppleScript failed: Error executing AppleScript on file /Users/domenicobettinelli/Library/CloudStorage/Dropbox/OF Projects/WHO372.txt.
2024-03-15 11:13:20.609 hazelworker[25881] OSAScript error: {
NSLocalizedDescription = "An error of type -36 has occurred.";
NSLocalizedFailureReason = "An error of type -36 has occurred.";
OSAScriptErrorAppAddressKey = "<NSAppleEventDescriptor: [0x0,2 \"hazelworker\"]>";
OSAScriptErrorAppNameKey = hazelworker;
OSAScriptErrorBriefMessageKey = "An error of type -36 has occurred.";
OSAScriptErrorMessageKey = "An error of type -36 has occurred.";
OSAScriptErrorNumberKey = "-36";
OSAScriptErrorOffendingObjectKey = "<NSAppleEventDescriptor: \"file:///Users/domenicobettinelli/Library/CloudStorage/Dropbox/OF%20Projects/WHO372.txt\">";
OSAScriptErrorRangeKey = "NSRange: {0, 0}";
}
Here is the script:
- Code: Select all
set file_content to (read theFile)
set the clipboard to file_content
tell application "Keyboard Maestro Engine"
do script "5A738B73-1E68-440B-8905-5B42AB94DA52"
end tell
Here is the rule:

But if I run the script manually in Script Editor, in addition to the manually run AppleScript running as it should, the Hazel rule also runs as it's supposed to be, and I get two projects in Omnifocus instead of one.
Any ideas? Thanks!