Possible to get data from a script to a custom attribute?

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

Moderator: Mr_Noodle

I have a rule which OCRs scanned PDFs and puts the text into an xattr. Then I match on the contents of the xattr to decide what to do with it.

However, Hazel doesn't give me a way to natively match xattrs, so I have to use a "Passes shell script" condition. Because of that, I don't appear to have the opportunity to pull bits out into custom attributes, which means I can't (for instance) rename the file based on the xattr's contents (without resorting to
Code: Select all
mv
in a shell script, which is proving messy).

Am I missing something? Or am I stuck doing my actions in Bash if I want to use the info from the xattr?
Peeja
 
Posts: 7
Joined: Thu May 31, 2007 4:34 pm

You can try using AppleScript. Shell scripts can be called from AppleScript though the resulting script may be a bit unwieldy. Nonetheless, something to try.
Mr_Noodle
Site Admin
 
Posts: 11875
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I'm not sure how that helps. AppleScripts can't add custom attributes any more than shell scripts can, can they?
Peeja
 
Posts: 7
Joined: Thu May 31, 2007 4:34 pm

Oh, they can! I was looking at old posts, not the actual Help Center docs. Thanks! That'll do nicely.
Peeja
 
Posts: 7
Joined: Thu May 31, 2007 4:34 pm

You got a solution for that? I am also desperately looking for a solution that allows my custom attributes to be used in a shell script. thanks!
vloryan
 
Posts: 25
Joined: Thu May 29, 2014 5:00 pm

As mentioned above, only possible with AppleScript (or JavaScript). You can execute shell scripts from AppleScript so you can go that route if you absolutely need to run a shell script in some form.
Mr_Noodle
Site Admin
 
Posts: 11875
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support