Page 1 of 1

Run a shortcut with folder as input

PostPosted: Wed May 31, 2023 7:09 pm
by Glaubrecht
Hi, I want to run a shortcut that takes the folder as input, but I get the following error message from hazel:

Error executing Shortcut via commandline.


Here are Screenshots of the rule and the screenshot
https://imgur.com/a/DCBk3RA

Do you have any idea why this could be?

Re: Run a shortcut with folder as input

PostPosted: Thu Jun 01, 2023 8:35 am
by Mr_Noodle
Can you edit the "input from" field to be "nowhere"? Unfortunately, Shortcuts is a bit obtuse but I'm guessing it's not a good idea to be overly specific with it.

Re: Run a shortcut with folder as input

PostPosted: Fri Jun 02, 2023 8:27 am
by Glaubrecht
Mr_Noodle wrote:Can you edit the "input from" field to be "nowhere"? Unfortunately, Shortcuts is a bit obtuse but I'm guessing it's not a good idea to be overly specific with it.


I tested that but it still returns the error.

Does hazel run shortcuts via command line? Is it possible, that shortcuts run via command line don't take folders as input?

shortcuts run "Select and set git user" -i xyz

returns
Error: The file “xyz couldn’t be opened.


So maybe that's the problem here? Not sure..

Re: Run a shortcut with folder as input

PostPosted: Fri Jun 02, 2023 9:13 am
by Mr_Noodle
Hazel does use the commandline as, at least at one point, the "mandated" way to run Shortcuts was broken. I'll have to look at it again but it seems to be a more general problem than Hazel. Does it work if you send it a file?

Re: Run a shortcut with folder as input

PostPosted: Mon Jun 05, 2023 3:47 am
by Glaubrecht
Mr_Noodle wrote:Hazel does use the commandline as, at least at one point, the "mandated" way to run Shortcuts was broken. I'll have to look at it again but it seems to be a more general problem than Hazel. Does it work if you send it a file?


Yes, a file as input works fine.

Re: Run a shortcut with folder as input

PostPosted: Mon Jun 05, 2023 8:38 am
by Mr_Noodle
Maybe get rid of the "Folders" requirement on the input in the shortcut?