Page 1 of 1

Shell script doesn't work even though rules match

PostPosted: 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?

Re: Shell script doesn't work even though rules match

PostPosted: Mon Aug 30, 2021 10:29 am
by Mr_Noodle
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.

Re: Shell script doesn't work even though rules match

PostPosted: Fri Sep 10, 2021 3:33 pm
by MiB
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.

Re: Shell script doesn't work even though rules match

PostPosted: Mon Sep 13, 2021 10:35 am
by Mr_Noodle
Try the troubleshooting guide here: https://www.noodlesoft.com/kb/hazel-tro ... ing-guide/

The logs should have any errors resulting from the scripts.