How to make a smart rule to rename, convert & move without leaving original behind?

How can I set up a smart rule that, on import, converts a .txt file that begins with the three characters in sequence “4x-” to .rtf, renames it to the Long Creation Date, and moves that .rtf to a different group in the inbox, without leaving the original .txt file behind (or deleting the originally imported .txt file)?

I always seem to have to leave the original .txt file in the trash, or in some other ad hoc group that it can’t be deleted from immediately.

This rule renames the file & deletes the original:

Please note that the last action is applied to the original. If you would use Convert & Continue, then the last action would delete the converted text.

That’s not quite what I meant.

For instance, this rule sends the plain text version to the trash, but leaves the converted .rtf in the Inbox - it doesn’t move it to the “special” group (which is a group inside the Inbox):

OK I find that this works, but is there any way of also deleting the .txt file left in the trash?

You’re still somewhat misunderstanding the flow of the input in smart rules. Once the input has changed, e.g., when using a Convert & Continue action, it can’t be returned to the original input (at least at this time, it can’t).

Look at this smart rule and notice the input never changes…

  1. Move the file to the Special group
  2. Change the file’s name
  3. Convert the file to a rich text file, yielding another file in the group with the new name
  4. Delete the file
1 Like

I see it now. Thanks for clarifying that for me. I was kind of stuck on the “move to trash” part and missed the “delete”.

No problem.

Hi,
this is an elder discussion, but I think my question matches the subject…
Trying to create a rule, that looks for PDF in the Income Folder, executes OCR, than looks for document Date and suggested name.
If I want to delete the original doc, it always deletes the new copy with the new name.
If I move it to another folder in the database, the rule doesn´t do anything…
I´m sure I´m just a little mistaken, so thanks for any help!

image

Regards Thilo

So, several things to say here:

  • if you use the Convert & Continue action instead of the OCR action, and move your Move to Trash action to the first position then all will work as intended. Convert & Continue means that all subsequent actions are performed on the new document. It may seem counter-intuitive to move the original file to trash first, but that’s the only way to act on the original - namely prior to the Convert & Continue action. Obviously your new file will be created in Trash, but that is of no consequence as you are already using a Move action.

  • alternatively you can forgo the Move to Trash action when using the OCR action if you choose the appropriate setting in the preferences (see OCR/Original Document: Move to Trash); AFAIK the following actions will then pertain to the OCR’d file.

  • currently your rule OCRs documents which already contain text; that can degrade document quality. You might want to add a second condition, namely Word Count is 0. That way only PDFs without a text layer will be treated by the rule. You could then set up a second rule with a Kind is PDF, Word Count is not 0 condition which only changes the name and moves the file, but does not OCR ist.

Or just use OCR > Apply and remove the Move to Trash action.

Isn’t that what I said? :smiley: With more words, of course - but you folk should be used to that by now :smiley: Criss, is the behaviour of OCR > Apply not dependent on the setting I mentioned? If it is, then the advantage of my first approach is that it would work for everybody, regardless of settings in the preferences (which I find preferable in a forum like this). If, of course, OCR > Apply is independent of preferences then I just wrote a long and pointless post :smiley:

OCR > Apply does not create a new record, therefore the setting doesn’t matter as nothing has to be moved to the trash.

1 Like

Hey,
thank you very much, both solutions work fine! Just starting with Devonthink, what a great tool!

Is there a way to check within in rule if OCR has already been performed? But I think there has to be an “if” condition? If no → perform, if yes → don´t ?
THX
Thilo

You can check for “words greater 0”

But will the rule continue the following steps (rename, move) if “word not greater 0”

That’s the idea.

Do you only want to rename the items after successful OCR? In that case I would suggest to use two rules:


The first one performs OCR on not yet searchable PDF documents and then applies the second rule which checks the word count and processes only searchable PDF documents containing text (e.g. after successful OCR).

Thank you, with two rules it works fine. So I move from Inbox-unchecked to Inbox OCR to Inbox renamed, that helps me at my actual knowledge level (0,0) to verify that the rules have been executed.

General remark: this is a very kind and helpful forum, wherever/whatever I read, thank you for that!
Have a nice christmas-time
Thilo

2 Likes