It’s not possible to use AppleScriptObjC embedded in Smart Rule scripts.
So you need to move
- the
use
statements (found at the top) - the handler (found at the bottom)
out of the script into a Script Library, i.e. a new scpt
file that will live in/Users/USERNAME/Library/Script Libraries/
.
See this post to see how a Script Library is called from another script.