Page 1 of 1

Shortcuts not running in Rules

PostPosted: Mon Feb 06, 2023 6:25 pm
by Zac
Hi all

I have a Shortcut that I am running to rename a file based on a Regex when I move it. Basically to remove a bunch of nomenclature from the end of the file name.

It works in Shortcuts and it works in the Finder but when I assign to to a rule nothing happens. It isn't appearing in the logs and no matter if I trigger it before or after the file moving it still isn't being launched.

Anyone have an idea why this would be the case?

TIA

Re: Shortcuts not running in Rules

PostPosted: Tue Feb 07, 2023 10:29 am
by Mr_Noodle
Can you post/send the shortcut?

Re: Shortcuts not running in Rules

PostPosted: Tue Feb 07, 2023 10:57 am
by Zac
Screenshot of it is here

https://imgur.com/a/sxNimKL

Re: Shortcuts not running in Rules

PostPosted: Wed Feb 08, 2023 10:39 am
by Mr_Noodle
I just entered in the shortcut (at least the first few actions. I don't think I have the "trim" action). I even added a notification at the end to print out the shortcut input.

Only other thing different was that I did not set the "input from <<>>" part. See if you can clear it out and see if it works after that.

Re: Shortcuts not running in Rules

PostPosted: Sun Feb 12, 2023 10:55 am
by Zac
What are you using to get the file reference?

Re: Shortcuts not running in Rules

PostPosted: Tue Feb 14, 2023 10:17 am
by Mr_Noodle
Not sure what you are asking. The file is sent in as input.

Re: Shortcuts not running in Rules

PostPosted: Tue Feb 14, 2023 10:20 am
by Zac
Could you post a screenshot of the Shortcut?

Re: Shortcuts not running in Rules

PostPosted: Wed Feb 15, 2023 10:43 am
by Mr_Noodle

Re: Shortcuts not running in Rules

PostPosted: Sun Feb 19, 2023 9:58 am
by Zac
So the issue is, as many of you already know, that Shortcuts works on a copy of the file you send it. So in my case Hazel was sending the file to the Shortcut and then the Shortcut was working on a copy. Hazel then moved the file it had and then Shortcuts left its copy in a temp directory.

I rewrote the Shortcut so that it renamed the file and then moved it to the correct directory and then Hazel deleted the original.

Any chance that there can be a regex option added to the rename action?

Re: Shortcuts not running in Rules

PostPosted: Tue Feb 21, 2023 10:51 am
by Mr_Noodle
Not directly. Check out "match patterns" in the help for similar functionality.