Shell script doesn't work even though rules match

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

Moderator: Mr_Noodle

Shell script doesn't work even though rules match Sun Aug 29, 2021 7:43 pm • by MiB
I have this rule
Image

that triggers this shell script
Code: Select all
 afconvert -d aac -f 'm4af' $1
.

The conversion works in the command line of Terminal with the current matching file in place "$1", but only if I add an output name at the end will it encode from Hazel. Does Hazel have issues with leaving off info to the shell?

This is in macOS Big Sur 11.5.2 on M1 hardware.

Any suggestions on what to improve/change?
MiB
 
Posts: 11
Joined: Fri Nov 28, 2014 3:54 am

Make sure to use the full path to the afconvert command. In general, you can't assume the same environment when scripts are run from Hazel as in Terminal.
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Make sure to use the full path to the afconvert command. In general, you can't assume the same environment when scripts are run from Hazel as in Terminal.

Thanks for the suggestion. Unfortunately, putting the full path into there doesn't make a difference. I also tried with another script and made sure Hazel has full disk access. In the logs I see "Processing folder [folder name]" some lines with no error info and then "Done Processing folder [folder name]". Notifications for errors are on.

Can I activate a debug mode or something? I'll keep trying of course, but at the moment it would seem no script will run. I also tried with this Applescript:
Code: Select all
set theDialogText to "The current date and time is " & (current date) & "."
display dialog theDialogText
.

Then I tried with "Display Notification" and this also doesn't run even as the Rules seems to be matching.

I wonder if it could have anything to do with permissions. However, next I'm pursuing this as not having anything to do with the script given those results.I'll seek to create any action to start as the result of the matching.
MiB
 
Posts: 11
Joined: Fri Nov 28, 2014 3:54 am

Try the troubleshooting guide here: https://www.noodlesoft.com/kb/hazel-tro ... ing-guide/

The logs should have any errors resulting from the scripts.
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support