(Solved) Import to Inbox and Rename

Hi All,

I currently have a folder where I save files that I want automatically added to my inbox. This is setup with a folder action. I then have a smart rule that appends the date to the filename of each file that is imported into my Devonthink Inbox.

Both the folder action, and the rule work well in that - any file saved to the folder appears in the inbox and any file I import into my inbox gets renamed.

The one problem is I would like any file I save to the folder to be imported into the inbox and then renamed. When I save a file to the folder it is imported by my rename rule does not get applied to the file.

Here is my rule

Any help would be greatly appreciated.

IIRC then actions undertaken by a script do not trigger smart rules (that could be an oversimplification of matters, and I don’t have time to look into this in any detail).

If I am right, then adding perform smart rule trigger import event record theRecord (change theRecord to whatever the script uses to reference the record) to the script (i.e. folder action) will solve the problem (i.e., trigger the On Import trigger).

Edit: the folder action Import & Delete uses set theRecord to import thePath to incoming group which can be followed by the line I posted above. The folder action Import does things slightly differently, using tell application id "DNtp" to import thePath to incoming group which would need to be changed to tell application id "DNtp" to set theRecord to import thePath to incoming group before adding the line I suggested above.

A folder action, triggering a script?
As @Blanc pointed out, the script code can trigger a smart rule
The script code can also do a simple rename, adding the date

  • Why do you have so many event triggers added?
    Did you see this on the MacSparky videos?

From personal experience: if you can’t figure out why a trigger isn’t happening, add more triggers and hope one of them does what you want. It never worked though. Of course, @mansonge may have had a different motive, but I’m too impatient to wait for them to answer your post :smiley:

LOL I just added everything during debugging

I solved it by indexing the folder, then using the smart rule on anything that is imported to the indexed folder.

That is a perfectly fine way of doing things.

That’s actually more what we advocate over Foldr Actions nowadays.

However, for your edification, you can use a form like this in a folder action…

perform smart rule name "Rename and Beep" trigger import event
1 Like

…which triggers a specific smart rule, as opposed to my suggestion which triggers all rules, top to bottom.

as opposed to my suggestion which triggers all rules, top to bottom.


That’s the same thing happens when a file triggers smart rules e.g. by being imported - rules run one after another from top to bottom (terminating, of course, when a valid cancel action is met). Sit back. Relax. Let things happen.