Passing a Custom Token to an AppleScript

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Without boring you with the reasons why (let's just say "custom logging for debugging") I would like to pass a token to an AppleScript that effectively has nothing to do with the file itself. What I want is to pass the Hazel Rule name to the AppleScript as a token. I'd be delighted if there was a way of doing so dynamically, but since I suspect there isn't, what I need is to create that custom token. Since the rule name has nothing to do with the file, I've tried creating that token using a condition as follows:

Comment - does not match - [RuleName]. (Where [RuleName] token text is "HAZEL RULE: Rental Statements")

This looks like it should work. The toekn gets created and I can select it and pass it to the (external) AppleScript along with 2 other tokens, but when I pass that new "RuleName" token to the script, it always has a "missing value". Is this because the token doesn't actually get populated for "does not match" condition...? Does it only work when it DOES match?

Any ideas on how I can make this work?
Lachlan Williams
 
Posts: 26
Joined: Fri Jun 11, 2021 4:06 am

Custom attributes only get set on a successful match otherwise if it fails and the value gets saved, it can screw up subsequent uses of that custom attribute.

For the moment, the only thing you can do is have a different version of that script for each rule. If it's an external script, maybe have an embedded script call it with that embedded script passing in the rule name.
Mr_Noodle
Site Admin
 
Posts: 11998
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support