I posted a basic JavaScript here
and here
The first parameter is of course the file you want to move. The second parameter is the “selector” for the group: It indexes into the groupSelector
object. In the example, it would be either “tag1” or “1234”. By adding more "selector": [database, group]
lines to the groupSelector
, you can provide for any number of groups here. I used the “database”, too, because I have identically named groups in different databases. So you might want to change that if you don’t need it.
I just use this one script for all of the Hazel rules that move things into DT: They call it as their last step providing the appropriate parameter.
I do not modify any dates for the files, though, but just add the statement date to the file name. Matter of taste, I guess.
Why do I do this with Hazel? Because in DT I’d need more smart rules. Hazel can process all account statements from the same bank with just one rule and I need only one script there to address all DT groups. So I’m handling three banks with a total of about 8 accounts with three Hazel rules and one script. I’d have to have eight smart rules in DT, which I find a bit uncomfortable. Also, I try to follow don’t repeat yourself
Alternatively, one could probably write an AppleScript for a smart rule in DT (JavaScript is not possible in DT smart rules, unfortunately). Since I don’t really like AppleScript, I didn’t try that.