Rule skips "Run Shortcut" step

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

Moderator: Mr_Noodle

Rule skips "Run Shortcut" step Tue Sep 12, 2023 1:55 pm • by rbanks88
I’ve made a shortcut that uses a Pixelmator Pro action to resize jpegs to 2000 px long dimension.

It works fine as a Finder Quick Action, but doesn’t resize when run via Hazel.

The Hazel rule has just two steps:
1. Run the shortcut
2. Move the file to another folder.

Hazel doesn’t run the shortcut, but it does move the file.

Probably a Shortcuts issue. Is there a workaround?

P.S. 2023 and Noodlesoft still runs a forum that doesn’t take uploaded images. Really?
rbanks88
 
Posts: 12
Joined: Fri Jan 08, 2016 11:15 am

Re: Rule skips "Run Shortcut" step Wed Sep 13, 2023 8:36 am • by Mr_Noodle
If the second action was executed, then that implies that the first one ran successfully.

You can turn on debug mode as described here: https://www.noodlesoft.com/kb/hazel-debug-mode/

After that, check the logs to get more details but my guess is that the Shortcut is being run but is not doing what you expect.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule skips "Run Shortcut" step Wed Sep 13, 2023 10:16 am • by rbanks88
Mr_Noodle wrote:If the second action was executed, then that implies that the first one ran successfully.

You can turn on debug mode as described here: https://www.noodlesoft.com/kb/hazel-debug-mode/

After that, check the logs to get more details but my guess is that the Shortcut is being run but is not doing what you expect.


Here's the log:--------------------------------

2023-09-13 07:48:03.681 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Thread 0x600001150b80: Received events (
{
date = "2023-09-13 13:48:03 +0000";
path = "/Users/rcb/Documents/Capture/Screenshots/Test-CP.jpg";
shouldDoFullScan = 0;
},
{
date = "2023-09-13 13:48:03 +0000";
path = "/Users/rcb/Documents/Capture/Screenshots/Test-CP.jpg";
shouldDoFullScan = 0;
}
) for stream at path: /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:03.682 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Thread 0x600001150b80: Run worker for folder: /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:03.719 hazelworker[5865] Running worker (v5.1.1) for folder with identifier: 16777232-313390.
2023-09-13 07:48:03.720 hazelworker[5865] ###main load address: 0x102044000
2023-09-13 07:48:03.720 hazelworker[5865] ###Hazel Core load address: 0x102264000
2023-09-13 07:48:03.720 hazelworker[5865] ###Noodle load address: 0x102580000
2023-09-13 07:48:03.720 hazelworker[5865] ###CK load address: 0x102144000
2023-09-13 07:48:03.725 hazelworker[5865] DEBUG: Program is licensed.
2023-09-13 07:48:03.733 hazelworker[5865] DEBUG: Error reading file /Users/rcb/Library/Application Support/Firefox/prefs.js: Error Domain=NSCocoaErrorDomain Code=260 "The file “prefs.js” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/rcb/Library/Application Support/Firefox/prefs.js, NSUnderlyingError=0x600000409140 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2023-09-13 07:48:03.734 hazelworker[5865] DEBUG: Could not find entry for default_directory in Chrome preference file.
2023-09-13 07:48:03.736 hazelworker[5865] Processing folder Screenshots
2023-09-13 07:48:03.736 hazelworker[5865] DEBUG: Pausing to wait for things to settle down.
2023-09-13 07:48:04.939 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Thread 0x600001150b80: Received events (
{
date = "2023-09-13 13:48:04 +0000";
path = "/Users/rcb/Documents/Capture/Screenshots/Test-CP.jpg";
shouldDoFullScan = 0;
}
) for stream at path: /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:04.939 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Thread 0x600001150b80: Run worker for folder: /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:04.939 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Task already running for folder: /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:05.741 hazelworker[5865] DEBUG: Processing directories: (
"/Users/rcb/Documents/Capture/Screenshots"
)
2023-09-13 07:48:05.780 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Checking events for path /Users/rcb/Documents/Capture/Screenshots, folder Screenshots
2023-09-13 07:48:05.780 hazelworker[5865] DEBUG: Received file event: {
date = "2023-09-13 13:48:04 +0000";
path = "<NoodlePathSet: 0x600000a0bf20>\n /Users/rcb/Documents/Capture/Screenshots/Test-CP.jpg : 0\n";
}
2023-09-13 07:48:05.780 hazelworker[5865] DEBUG: About to process directory /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:05.781 hazelworker[5865] DEBUG: .DS_Store: File is hidden/invisible. Skipping.
2023-09-13 07:48:05.781 hazelworker[5865] Test-CP.jpg: Rule Size 2000 and move to LR watched folder matched.
2023-09-13 07:48:05.781 hazelworker[5865] DEBUG: New rule signature. Executing actions.
Old signatures: (
)
New Signature:{displayBasename hazelEndsWithString: "-CP"}:{(move:/Users/rcb/Documents/Photo/Commonplace Folders/LR Watched Folder,{
replaceExisting = 0;
throwAwayDupes = 0;
})(shortcuts:A8CC3AB3-0639-4F0D-8B39-821CA79E7B72,{
})}
2023-09-13 07:48:05.782 hazelworker[5865] [File Event] File moved: Test-CP.jpg moved from folder /Users/rcb/Documents/Capture/Screenshots to folder /Users/rcb/Documents/Photo/Commonplace Folders/LR Watched Folder.
2023-09-13 07:48:05.940 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Thread 0x600001150b80: Received events (
{
date = "2023-09-13 13:48:05 +0000";
path = "/Users/rcb/Documents/Capture/Screenshots/Test-CP.jpg";
shouldDoFullScan = 0;
}
) for stream at path: /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:05.940 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Error resolving symlinks for path /Users/rcb/Documents/Capture/Screenshots/Test-CP.jpg:, No such file or directory
2023-09-13 07:48:05.940 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Thread 0x600001150b80: Run worker for folder: /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:05.940 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Task already running for folder: /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:08.096 hazelworker[5865] DEBUG: == Shortcuts output ==
(null)
== End Shortcuts output ==
2023-09-13 07:48:08.096 hazelworker[5865] DEBUG: Shortcut Resize to 2000 jpeg executed successfully with file /Users/rcb/Documents/Photo/Commonplace Folders/LR Watched Folder/Test-CP.jpg
2023-09-13 07:48:08.096 hazelworker[5865] DEBUG: Rule executed. Updating match date for file /Users/rcb/Documents/Photo/Commonplace Folders/LR Watched Folder/Test-CP.jpg: 2023-09-13 13:48:05 +0000
2023-09-13 07:48:08.096 hazelworker[5865] DEBUG: Action changed file: Test-CP.jpg
2023-09-13 07:48:08.096 hazelworker[5865] DEBUG: File /Users/rcb/Documents/Photo/Commonplace Folders/LR Watched Folder/Test-CP.jpg moved out of folder. No longer tracking.
2023-09-13 07:48:08.097 hazelworker[5865] DEBUG: Writing out DB file for /Users/rcb/Documents/Capture/Screenshots to path: /Users/rcb/Library/Application Support/Hazel/16777232-313390.hazeldb
2023-09-13 07:48:08.097 hazelworker[5865] DEBUG: Directory /Users/rcb/Documents/Capture/Screenshots processed in 2.316894 seconds
2023-09-13 07:48:08.097 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Checking events for path /Users/rcb/Documents/Capture/Screenshots, folder Screenshots
2023-09-13 07:48:08.097 hazelworker[5865] DEBUG: Received file event: {
date = "2023-09-13 13:48:05 +0000";
path = "<NoodlePathSet: 0x600000a20aa0>\n /Users/rcb/Documents/Capture/Screenshots/Test-CP.jpg : 0\n";
}
2023-09-13 07:48:08.097 hazelworker[5865] DEBUG: Sleeping
2023-09-13 07:48:10.108 hazelworker[5865] DEBUG: About to process directory /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:10.110 hazelworker[5865] DEBUG: .DS_Store: File is hidden/invisible. Skipping.
2023-09-13 07:48:10.110 hazelworker[5865] DEBUG: Writing out DB file for /Users/rcb/Documents/Capture/Screenshots to path: /Users/rcb/Library/Application Support/Hazel/16777232-313390.hazeldb
2023-09-13 07:48:10.111 hazelworker[5865] DEBUG: Directory /Users/rcb/Documents/Capture/Screenshots processed in 0.002302 seconds
2023-09-13 07:48:10.111 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Checking events for path /Users/rcb/Documents/Capture/Screenshots, folder Screenshots
2023-09-13 07:48:10.111 hazelworker[5865] DEBUG: Writing out DB file: /Users/rcb/Documents/Capture/Screenshots
2023-09-13 07:48:10.112 hazelworker[5865] DEBUG: Sending metrics to scheduler. Next scheduled run: 4000-12-31 17:00:00.000
2023-09-13 07:48:10.112 hazelworker[5865] Done processing folder Screenshots
2023-09-13 07:48:10.112 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Received metrics for folder /Users/rcb/Documents/Capture/Screenshots: {
directoryDepth = 0;
requestedSchedulingTime = "4001-01-01 00:00:00 +0000";
triggerPaths = "<NoodlePathSet: 0x600000474ba0>\n";
unavailablePaths = "{(\n)}";
}
2023-09-13 07:48:10.112 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Timer scheduled for folder /Users/rcb/Documents/Capture/Screenshots at 4001-01-01 00:00:00 +0000
2023-09-13 07:48:10.115 86Z3GCJ4MF.com.noodlesoft.HazelHelper[77567] DEBUG: Thread 0x600001150b80: Task removed: [5865]

----------------------------------------------------------------

I’ve bolded text that may be of interest...

First bold: I have no idea why Hazel is trying to deal with Firefox or Chrome. No browser is involved with this rule.

Second bold: Says file was moved, as I’ve observed. Although the file move action follows the run shortcut action, I don’t see any reference to the run shortcut action before this log entry.

Third bold: Error resolving symlinks. (May be related to post I reference below.)

Fourth bold: Shortcut Resize to 2000 jpeg executed successfully. Hazel must be confused here. (see below)

I found this post at viewtopic.php?f=4&t=14753&p=37859&hilit=shortcut+not+running#p37859

This post offers:

"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."

Could this be where Hazel's getting confused, hitting the symlink error, and thinking the shortcut was executed successfully?

Thanks,
Russell
rbanks88
 
Posts: 12
Joined: Fri Jan 08, 2016 11:15 am

Re: Rule skips "Run Shortcut" step Thu Sep 14, 2023 8:25 am • by Mr_Noodle
The Chrome stuff has nothing whatsoever to do with this. Hazel sometimes needs to determine if a folder is a download folder for various programs, including Chrome.

Can you post screenshots of your rules? You can't host images here so if you don't have your own file sharing service, you can use imgur.com.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule skips "Run Shortcut" step Fri Sep 15, 2023 2:05 pm • by rbanks88
Mr_Noodle wrote:The Chrome stuff has nothing whatsoever to do with this. Hazel sometimes needs to determine if a folder is a download folder for various programs, including Chrome.

Can you post screenshots of your rules? You can't host images here so if you don't have your own file sharing service, you can use imgur.com.


Here's the rule. Actually pretty simple, AFAIK.

https://drive.google.com/file/d/1mYWPTB ... share_link
rbanks88
 
Posts: 12
Joined: Fri Jan 08, 2016 11:15 am

Re: Rule skips "Run Shortcut" step Mon Sep 18, 2023 9:06 am • by Mr_Noodle
Can you post an image of the Shortcut itself?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule skips "Run Shortcut" step Sun Sep 24, 2023 9:40 am • by rbanks88
Mr_Noodle wrote:Can you post an image of the Shortcut itself?


Sorry for the delay. Here's the Shortcut:

https://drive.google.com/file/d/14oKaPt ... share_link
rbanks88
 
Posts: 12
Joined: Fri Jan 08, 2016 11:15 am

Re: Rule skips "Run Shortcut" step Sun Sep 24, 2023 9:54 am • by rbanks88
Just replying with the "notify" checkbox ticked.
rbanks88
 
Posts: 12
Joined: Fri Jan 08, 2016 11:15 am

Re: Rule skips "Run Shortcut" step Mon Sep 25, 2023 8:42 am • by Mr_Noodle
Can you change the first action to "Receive FIles & Folders input from Nowhere"?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule skips "Run Shortcut" step Tue Oct 03, 2023 3:59 pm • by rbanks88
Yes, I can change the first action to "Receive FIles & Folders input from Nowhere." But then how do I trigger it for the selected Finder item?
rbanks88
 
Posts: 12
Joined: Fri Jan 08, 2016 11:15 am

Re: Rule skips "Run Shortcut" step Wed Oct 04, 2023 8:35 am • by Mr_Noodle
It doesn't work that way. Rules match a file and send that file. It should be independent of whatever Finder has selected.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule skips "Run Shortcut" step Wed Oct 04, 2023 11:02 am • by rbanks88
You're right. I was confusing it with another little project!

As you suggested, I changed the first Shortcuts action to "Receive Files & Folders input from Nowhere," and still, the Shortcut doesn’t do its resizing, but Hazel does move the file.

I recall reading something about Shortcuts making a copy of the file somewhere in the user Library, doing its processing on the file, then copying it back to its original folder. That may be confusing Hazel. However, it seems Hazel would have such trouble all the time, making it unfeasible to work with Shortcuts.
rbanks88
 
Posts: 12
Joined: Fri Jan 08, 2016 11:15 am

Re: Rule skips "Run Shortcut" step Thu Oct 05, 2023 9:21 am • by Mr_Noodle
If Shortcuts is doing that, then that would be very bad form. Do you recall if it's just certain actions that do that?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rule skips "Run Shortcut" step Thu Oct 05, 2023 10:17 am • by rbanks88
Here's where I got the idea of Shortcuts and other folders:

http://www.noodlesoft.com/forums/viewtopic.php?f=4&t=14147
rbanks88
 
Posts: 12
Joined: Fri Jan 08, 2016 11:15 am

Re: Rule skips "Run Shortcut" step Fri Oct 06, 2023 9:32 am • by Mr_Noodle
Ultimately, if Hazel is moving the correct file at the end, then there's an issue with Shortcuts not putting the file back. And as that thread states, there's a bug in Shortcuts where its output does not transmit back properly. You'll have to use a script as the poster there did.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Next

Return to Support