Exploding notes

I make annotations with PDF Expert and export them as text, then I create a note in Tinderbox and paste all annotations into it. After that I want one note per annotation and I explode the note.
.
PDF Expert creates an entry for each annotation like “Highlight [page 51]:” and I want this as the title for each note, but I can only use first sentence with full stops/dots.

Is there any possibility using colons instead of full stops for the first sentence?
Or is there any other possibility to get “Highlight [page 51]:” as title?

If I understand correctly, the source problem here is PDF Exert has no decent export configurations and you’re left using the default. You also want to use part of a sentence (up to a colon) as a title.

OK, so PDF Export has let you down, but it’s worth saying if you haven’t tried all the source app’s export method try fixing further in the process.

I made some test ‘source’ $Text:

Highlight [page 5]: First note. More stuff.

Highlight [page 51]: Another note. More stuff.

Highlight [page 501]: Different note. More stuff.

Highlight [page 5001]: Last note. More stuff.

I tried this stamp in Tinderbox (v7.5.6), without success:

$Text=$Text.replace("(Highlight \[page \d+\]: ","$1\n");

…though in fairness I’m also assuming $1 would change for each different page number. Indeed I don’t know if this sort of regex-based use of .replace() on $Text in this way was envisaged as a regular task. When testing this, my app tended to sit churning away which indicates a lot of ‘thinking’ is going on and I had to force quit.So, I pasted my sample source text into BBEdit and did:

  • Find: (Highlight \[page \d+\]):
  • Replace: \1.

This is just the sort of task for which such tools are intended. Anyway, the result is this $Text:

Highlight [page 5]. First note. More stuff.
Highlight [page 51]. Another note. More stuff.
Highlight [page 501]. Different note. More stuff.
Highlight [page 5001]. Last note. More stuff.

Now, if we Explode the $Text on paragraphs, using the first sentence as the title and omitting it from the note text.

Whilst Tinderbox has some pretty nifty text tools, regex get complicated quickly and the need for using such with Explode such invariably points back to poor data export upstream. I don’t have PDF Expert but it might be worth contacting the dev to ask for more sensible export options. Failing that, a competent text editor with regex support like BBEdit (which has a free version) or Sublime Edit are your friends when dealing with poorly formatted source data.

Mark Anderson’s answer is great, but I think I see another way to do what you want. (Tinderbox is often like that!)

Step 1: Explode the notes, using the default choice to make the first sentence the title.

This gives you the notes you want, but leaves too much unwanted text in the title.

Step 2: adjust the titles.

I think this is probably best done as a stamp. What do we want to do? We want to find the colon, and delete it — and everything that comes after it.

Step 2a. Find the colon

$MyNumber=$Name.find(‘:’);

Step 2b

$Name=$Name.substr(0,$MyNumber)

So, our stamp becomes:

$MyNumber=$Name.find(‘:’);$Name=$Name.substr(0,$MyNumber)

@mwra, what you suggest I did with Sublime Edit before and this will work. Also it is an extra step I want to avoid.

@eastgate, working with stamps is a good example for me how Tinderbox works and “thinks” and I will try some other things with stamps, like deleting notes with out a title or which are empty.

So thank you both for your suggested solutions :slight_smile:

Or for another approach, you could use the free open-source Skim PDF editor i place of PDF Expert (or just use it to export the annotations) - one of the advantages of Skim is that it lets you create your own custom templates for exports of notes, thus avoiding the need for post-export manipulations.

2 Likes