Not sure if this would be a rule or a script...Or if something like it already exists

Not sure exactly what I’m looking for, but here’s the issue.

I used the Evernote web clipper for years, and recently imported all my EN notes to DT. But when DT imports a web clipped note from Evernote, it A. Creates a group, and B. Includes in that group (1) an .html file that is mostly empty content, AND (2) a .pdf of the actual document.

I would like to extract the pdf from the group and delete both the group and the useless .html file therein.

Here’s what it looks like now:

Subject Matter/Item Name
[Indent] Subject Matter/Item Name.html
[Indent] xxyyjibberish[date]blahblahblah.pdf.

My goal would be a single document, in the same db, that is just called Subject Matter/Item Name.pdf. I would settle for just stripping the .pdf out of the subgroup–regardless of what it’s named–inserting it in the db at the top level and trashing the other useless stuff, i.e., the group and the html.

TIA

Like this script Quick way to delete 'empty' imported Evernote notes - #9 by BLUEFROG

3 Likes

Actually the smart rule that Bullfrog created does sort of the opposite. It extracts the .html from the folder, but leaves the folder and .pdf intact. I want to extract the pdf, not the html.

I tried changing the criterion from “formatted note” to .pdf, but that did not work.

Maybe an easier question would be how to extract docs with certain extensions from folders (like all .pdf, .doc, etc.) That sounds easier, but I have no clue as I do not know how to script and it takes me hours to figure out how to create even the simplest of simple rules.

I did find a workaround by duplicating entire groups to an empty test database and then using the built-in .pdf locator, but that feels pretty wonky.

I think you’re mistaken; the script works for me
We can assist if you process script lines you’re having trouble with

Thank you. I will need assistance. The script works for me in the way I have described. As always with these things, I assume I’m wrong. Somewhere.

Ok, I’ll start
The script is processing the the .html files generated with the import from Evernote
if (count paragraphs) of (plain text of theRecord as string) = 1 then
Checks for “mostly empty content”; a single link line

Thanks. I understand that that is what it looks for but my experiments do not do what I want.

It EXTRACTS the “mostly empty content” html file, but leaves the gibberish.pdf in the group that has the name I’m seeking, so that I’m left with [Group] containing gibberish.pdf. What I am aiming for is to extract the pdf, rename it to the group name, and delete the group and the “mostly empty contents” html.

4 Screenshots

  1. Test DB with some items from the Evernote import duplicated to it. (Just some ancient cell phone bills, named with their dates)
  2. The rule that I downloaded set to work on the Test DB
  3. The output after running that rule.
  4. The Test DB, after running that rule.

I’m sure there’s something wrong with the rule (as I am employing it), but I just imported the .zip as it was from Bullfrog’s post.

I’m virtually certainties is all user error, but I don’t know what.

Please show us the script being run

I see the move line in the script
however this should only execute with children …whose type is not formatted note

Well, it does what it does. And if you’re telling me that it’s misbehaving, then I’m lost.

Any advice or should I go back to my clunky workaround?

Instead of parent 1 which might be a tag it would be more reliable to use the location group property.