How to use the output of a shell script in a Rename action

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

Moderator: Mr_Noodle

I have a shell script which - based on the given file - returns/outputs a new file name.

How can I use that output in the Rename action?
halloleo
 
Posts: 59
Joined: Thu Apr 27, 2017 10:10 pm

You can't do it from a shell script. You would either need to (a) use an AppleScript and specify the new target in the return record or (b) have a separate rule to match the output file.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:You can't do it from a shell script. You would either need to (a) use an AppleScript and specify the new target in the return record


So an Applescript can tell Hazel a match variable which Hazel then can use in its Rename Action. Hiw can an Applescrdo this?

Mr_Noodle wrote:(b) have a separate rule to match the output file.


I don't understand this one: How can a seperate rule do the Renaming do better than the first one?

Maybe I wasn't clear enough: My Shell- or Applescript does return a file name (string). It does not rename the file. I want to leave the renaming to Hazel.
halloleo
 
Posts: 59
Joined: Thu Apr 27, 2017 10:10 pm

Ok, that's a bit different. You would still need to use AppleScript to export that as a custom attribute which you can then access in a subsequent Rename action.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Ok, that's a bit different. You would still need to use AppleScript to export that as a custom attribute which you can then access in a subsequent Rename action.


I see. Thanks. I found https://www.noodlesoft.com/manual/hazel ... Attributes. That might get me there I guess.
halloleo
 
Posts: 59
Joined: Thu Apr 27, 2017 10:10 pm

Got it working. Thanks for your help. :D
halloleo
 
Posts: 59
Joined: Thu Apr 27, 2017 10:10 pm


Return to Support