How best to configure rules for a complex manoeuvre

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

Moderator: Mr_Noodle

Time to consult the brains trust, I think. (i.e. incl Mr Noodle, but hoping others might have wisdom to share ... ).

This file management strategy probably reflects my obsessive detail streak, but that's me ... What I want is:
  1. Document X (mostly PDFs) lands in downloads folder,
  2. Matches at least one condition (e.g. statement from Bank Y)
  3. Then the following in whatever order might be best:
    1. Designated tags applied
    2. Renamed based on designated name string followed by date created (based on match to document contents)
    3. Edit metadata for date created (+ modified) to reflect (new) filename
    4. Moved to ~/Documents/Folder-Z/
      • Then - sorted into subfolders (yyyy>MM>dd by created date)

I've largely got what I want. Well let's say 90% ... Chief sticking point seems to be the metadata edit. That will need some background info. Some may be familiar with apps from publicspace.net, in particular A Better Finder Attributes and A Better Finder Rename. Both apps allow the generation of custom droplets.

A droplet from the former is what I've been trying to use in this set of rules. So the idea in theory is that there's an action to "drop on"/"open with" the droplet to change the dates. I have a similar droplet working flawlessly in a Hazel rule for another nest of folders. So it's been puzzling me why not with this one, where "A Better Finder Attributes" has been crashing, hanging, beachballing etc. (And I suspect taking Hazel with it?)

I now have the answer from the PublicSpac dev. The apps (and derived droplets) are heavily and of necessity restricted in what they can do with subfolders. So a clash between ABF... rules and Hazel rules, it seems. Hope you're following me so far, guys. Don't want to bore you. But I am finding this hard to describe succinctly.

So the rules as I have them currently:
First stage: Downloads
Image

2nd stage: "Folder-Z"
Image

I'm not 100% sure how the conflicting rules play out in this, but I suspect it's a matter of the droplet in the second stage being "gazumped" by other actions, particularly "Sort into subfolders ... ". I've disabled the "go into subfolders" rule (having it enabled before caused a nightmare, a story for another time). So I imagine that when File X disappears from the top level of the folder down the rabbit-hole of the subfolder hierarchy, the Droplet loses effective access to it by its own rules.

My best theory so far, therefore, is that I need a way of stopping the "sort into subfolders" action from firing too early, i.e. while the "more cautious" ABF.. parent app is doing it's thing. Does all tht sound a fair hypothesis? If so then I would just observe that I've found some of the more complex Hazel rules hard to "control" as far as speed and workflow order. e.g. I often see notifications about 'earlier' actions after those about 'later' ones. Moving actions seem especially like this. My question then is whether it's functionally possible to modify Hazel rules with 'delay' actions. I've tried various lengths of the "delay xx" command using an embedded AppleScript. No apparent success there. I've dabbled a little in "not in the last X minutes" conditions. Little joy there.

So ... apologies again for a thesis-length post. Hope at least one or two are still awake. Am I going about this the right / best way? Is there a viable alternative?
Last edited by eN0ch on Sat Jan 28, 2023 12:55 am, edited 27 times in total.
Lance <º))><

iMac 24" 2021 M1 | macOS 13.3.1a | Hazel 5.2.1
eN0ch
 
Posts: 63
Joined: Tue Jul 01, 2008 7:41 pm
Location: Crookwell, NSW, Australia

Images aren't coming through but from your description, my guess is that the droplets return back to Hazel before they are done with their task. Can you do the droplet at the end after filing into the subfolder?
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Images aren't coming through


On which see my comment on an old thread on the "forum / site discussion" forum. I gave up trying to figure out how to get the images to work. I did notice later that the Imgur server was reported as down, and that is not an uncommon occurrence.

but from your description, my guess is that the droplets return back to Hazel before they are done with their task. Can you do the droplet at the end after filing into the subfolder?


Thanks Paul. I think that might be the Catch 22 though. I have the "go into subfolders" rule disabled. (That's because having it turned on in that folder with the "sort into subfolders" resulted in an unholy mess with literally hundreds of unwanted hierarchies of subfolders (sub-sub, etc). Apart from which there's the limitation on the droplet doing stuff in subfolders anyway. So if I'm understanding correctly, the droplet has a brain spasm trying to chase the files into the subfolders. I imagine that would rule out your suggestion? But then again this could well be all a matter of my ignorance. Is there something I'm missing?
Last edited by eN0ch on Sat Jan 28, 2023 1:07 am, edited 1 time in total.
Lance <º))><

iMac 24" 2021 M1 | macOS 13.3.1a | Hazel 5.2.1
eN0ch
 
Posts: 63
Joined: Tue Jul 01, 2008 7:41 pm
Location: Crookwell, NSW, Australia

P.S. I've fiiiiiinally got the images bit worked out. I didn't have the file extension at the end of the URL string. (In my defence Imgur doesn't include it either in the links copied from the image post).

P.P.S And I've now fiiiiiiiiiiiiiiiiiiiiinally got the nested list sorted also.

(BBcode has the better of me, I think)
Lance <º))><

iMac 24" 2021 M1 | macOS 13.3.1a | Hazel 5.2.1
eN0ch
 
Posts: 63
Joined: Tue Jul 01, 2008 7:41 pm
Location: Crookwell, NSW, Australia

Just want to bump this post to make sure it hasn't been forgotten. Thanks.
Lance <º))><

iMac 24" 2021 M1 | macOS 13.3.1a | Hazel 5.2.1
eN0ch
 
Posts: 63
Joined: Tue Jul 01, 2008 7:41 pm
Location: Crookwell, NSW, Australia

So is it working now or did you still need help?
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hi Paul,

Thanks. No, no solution at this point. I'm really stuck on how to order the actions between the two monitored folders in a way that gels with ABFAX's rules about subfolders. It might help you to help me if I paste some of what the publicspace.net guy said:
A Better Finder Rename's "process subfolders and their contents" feature requires that the files that you drop into A Better Finder Rename respect certain rules, i.e. you can't add an item that is in a subfolder of an item already in the preview. This is hard to explain, but it would produce quite a mess and be very confusing if A Better Finder Rename allowed this because certain files in subfolders would not disappear from the list when the option is unticked, while most would, there's problems with processing, the intelligent ordering of renames to avoid deadlocks, conflict resolution, etc..

All this is pretty technical and takes a while to wrap your head around, but you don't really need to understand the underlying reasons.

The practical offshoot is that the program disallows this in the normal interactive mode, but does not verify this edge case when you use a droplet where there is no interactive control. This manifests in not being able to drop search results into A Better Finder Rename or A Better Finder Attributes because the files are from all over the file hierarchy.

I suspect that the automatic Hazel rules conflict with those rules and thus create crashes and deadlocks. So it's best not to call the droplet from a hazel rule, or call the droplet once per file.
Lance <º))><

iMac 24" 2021 M1 | macOS 13.3.1a | Hazel 5.2.1
eN0ch
 
Posts: 63
Joined: Tue Jul 01, 2008 7:41 pm
Location: Crookwell, NSW, Australia

I think I'd agree to have the droplet only run on files and not do any subfolder stuff. You can have Hazel go into subfolders instead.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:I think I'd agree to have the droplet only run on files and not do any subfolder stuff. You can have Hazel go into subfolders instead.


OK can I tease that out a little? I can't turn on the "Go into subfolders" rule at the top of the list for the folder because of other problems resulting. If I put that rule down to second from last, after the "sort into subfolders" action and before the rule that calls the droplet (+ don't use "continue matching") ... would that work? Can one do that with the "Go into subfolders" rule? Or would it apply to all rules regardless of its own place in the order? What I absolutely must avoid is having the "sort into subfolders" action going into subfolders.

NB This is all clouded by some system issues I'm having right now, involving a dying ext-HDD. Hopefully that will be resolved in the next few days. I'll try to post back here after that's sorted.
Lance <º))><

iMac 24" 2021 M1 | macOS 13.3.1a | Hazel 5.2.1
eN0ch
 
Posts: 63
Joined: Tue Jul 01, 2008 7:41 pm
Location: Crookwell, NSW, Australia

Do you have any other rules matching folders besides the subfolder rule? If so, I'm guessing that is not the way to go since you want to send files, not folders, to the droplet.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Here's where I'm up to now:

  • Created folder ~/Downloads/Processing/dating
  • redirected all filing rules to that folder
  • First action in that folder = "open with" droplet, then "continue matching"
Image
  • Second action in folder = "move to 'Filed Documents'" (provided they're at least 10 minutes 'old')
Image
  • Folder "Filed Documents" now has just one rule, viz "sort into subfolders"
Image

All helped greatly by having retired my dying ext-HDD TM volume, in favour of a new SSD.

So far so good. All seems to be working as it should without hangs, crashes, etc. (But I'm not about to declare it "solved" just yet ...)
Lance <º))><

iMac 24" 2021 M1 | macOS 13.3.1a | Hazel 5.2.1
eN0ch
 
Posts: 63
Joined: Tue Jul 01, 2008 7:41 pm
Location: Crookwell, NSW, Australia

I think it might be better to move the file first then call the droplet. You want the droplet to be the last thing in the process.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:I think it might be better to move the file first then call the droplet. You want the droplet to be the last thing in the process.


OK, thanks. Clarifying question then (and something I've been unclear about all along actually) -- Is matched rule P on folder Q still able to act on file X after previous matched rule Y has moved X to folder Z? (Bearing in mind that folder Z will immediately sort file X into a subfolder with depth 3). Can you see what I'm asking?
Lance <º))><

iMac 24" 2021 M1 | macOS 13.3.1a | Hazel 5.2.1
eN0ch
 
Posts: 63
Joined: Tue Jul 01, 2008 7:41 pm
Location: Crookwell, NSW, Australia

If a file has been moved, any actions in the same rule will work on the file at the new location. It won't if it's in a separate rule. But, for example, you move the file into a subfolder, and you have a rule to have Hazel go into subfolders, it can possibly encounter the file again and then act on it.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:… you move the file into a subfolder, and you have a rule to have Hazel go into subfolders, it can possibly encounter the file again and then act on it.


Sure. But that's not quite what I have here. Mainly the "go into subfolders" is disabled for that folder because of an earlier disaster where the combination of that and "sort into subfolders" resulted in multiple depths of subfolder structures with stray files buried at the bottom. So it would seem that I can't have both those subfolder rules operating together on the same monitored folder ...

... unless there's an alternative way to configure one or more of the rules so they play nicely together??
... or unless (see earlier in the thread) it might work to order the "go into" after the "sort into"

Anyway ... I think it might be going ok with the setup described in my previous post (?)
Lance <º))><

iMac 24" 2021 M1 | macOS 13.3.1a | Hazel 5.2.1
eN0ch
 
Posts: 63
Joined: Tue Jul 01, 2008 7:41 pm
Location: Crookwell, NSW, Australia

Next

Return to Support