Tinderbox Forum

Highlighted notes only

Thanks for all your previous help. I am gradually starting to get my workflow organised, and as suggested I am making sure that what I want as an ‘end result’ can be achieved.

so…
The original document will be indexed in DEVONthink from a cloud folder containing all my books/pdf’s (probably held in a reference manager - but I haven’t worked out which is the best one for me yet…maybe Bookends)

I will open that pdf on my iPad where I will mark and highlight pdf’s on my iPad using my apple pencil and either goodnotes/notability etc and save that as an edited pdf. (later on I will add a Hazel script to remove duplicates leaving the most recent copy etc)

I then want to import just those highlights into Tinderbox where I will connect/edit etc

How do I get just those highlights in?
I am hoping that I can create a something that only shows those highlighted notes and that I can use exploding files in Tinderbox.

I am still very much a newbie with TB.

Thanks

Surely before importing the highlights to Tinderbox, you need to export them from your PDF reader - or the app used for marking them up. Quite a few PDF readers will export notes and highlights, for instance the (free) app Skim. The exported text can then be easily imported into Tinderbox giving you just the highlighted text and annotations about it.

Great - I have got that exporting the highlights into TB sorted.
Notate/edit/highlight in MarginNotes
Export to DEVONthink as an RTF document
Drag that file into TB
Notes are created.

is there a way to set up an Agent (?) to automatically swap the first row of text to become the Title and to move the current title to become a footer. or attribute???

When the notes are added to TB the title is showing as the page number and the book and I would prefer to see the first sentence as the title.

thanks

Indi

First, some terminology possible confusions:

  • Tinderbox notes don’t have a notion of a footer - except during export (and then only via use of export templates.
  • The first ‘row’ of a note’s $Text is fluid and the contents depend on the width of the text pane. Sentences and paragraphs (e.g. text up to the first line break) can be detected. Note, though the Tinderbox doesn’t have an action method for iterating sentences or paragraphs. You can apply a .split("n") and take the first item .at(0), but you are advised to remove/replace all semi-colons before doing so or you may get odd results: a semi-colon is Tinderbox’s list item delimiter and in this $Text context they confuse the app under the hood (known issue, reported)

So assuming the $Text has no semicolons, make this your agent’s action to add the title ($Name) to the end of $Text and extract the first first sentence of $Text and make it the note title:

$Text = $Text + "\n" $Name;
$MyString = $Text.split("\n").at(0);
$Name = $MyString;
$MyString =$MyString.replace("\?","\\\?");
$Text = $Text.replace($MyString+"\n","");
$MyString=;

But:

  • without extra code you can’t stop this running every agent cycle and thus setting the current paragraph #1 at the $Name until the note has to $Text and no $Name
  • We have to guard against a ‘?’ character in the book title as that otherwise is treated in a regex character when doing the text replacement.

Therefore I suggest using the code as a stamp rather than an agent action. A stamp only runs rxactly once, per application.

If you want the existing title to go somewhere else, just replace the first line of code above with one passing the current $Name to your attribute of choice.

Other options - be less focussed on fixing this issue where spotted. As you art the start of the process consider:

  • MarginNote. From helping other MN users it seems the rtf simply exports the contents of the annotation. Consider altering the order of items in your annotation. IOW, fix things at source if possible, beforev you’ve too much data to make this possible.
  • DEVONthink. As you’re using DT, it might make sense to simply use AppleScript in DT (where there’s far more scripting use/expertise) to transpose paragraphs 1 & 2 such that when added to Tinderbox they import correctly without the further need for action (plus if you do this in AppleScript in Tinderbox, you’ve more tasks to do as you’ve got to dela with the ‘wrong’ title issue). @PaulWalters has far more DT expertise and may have a better take on this.

Hi

Thank you for this.

I copied and pasted this and created a stamp! yeah me!
into the note and it did work to some extent.
It definitely swapped the first line for the title. However the title did not move to the end of the main body of the text . I made sure there were no ?
So as per your suggestion

‘If you want the existing title to go somewhere else, just replace the first line of code above with one passing the current $Name to your attribute of choice.’

This is what I need to do -,however as a complete struggling beginner I don’t know how to do this.

Please can you advise?

Many thanks

I don’t have MarginNote, but I understand that what you have succeeded in bringing into Tinderbox via DEVONthink is page number and book name in the Name of the each imported note and in the Text of each imported note you have a first line followed by a return and then the rest of the annotation. You would like that first line as the Name of the note and would like the imported name (page number and book name) to be placed in an attribute.

This can be done quite easily on the Tinderbox end with a short AppleScript, something like this:

set newAttributeName to "PageBookMN" -- change to whatever you want to call the new attribute
tell front document of application "Tinderbox 8"
	make new attribute with properties {name:newAttributeName, type:"string"}
	repeat with aNote in selections
		tell aNote
			set {importedName, importedText} to {name, value of attribute "Text"}
			set name to first paragraph of importedText
			set value of attribute "Text" to (paragraphs 2 thru -1 of importedText as text)
			set value of attribute newAttributeName to importedName
			set value of attribute "KeyAttributes" to value of attribute "KeyAttributes" & ";" & newAttributeName
		end tell
	end repeat
end tell

Simply copy-paste the script (be sure to scroll if needed to select the whole thing) into Script Editor (in Applications > Utilities), select the imported notes that you want to “fix,” and click the ‘run’ button in Script Editor. If you haven’t used scripts before you may need to make sure Script Editor and Tinderbox are listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility.

An advantage of using a script as opposed to internal action code is that you can save it and reuse it with other Tinderbox documents without having to set up a stamp again.

If this one doesn’t quite do what you want, just post, and it can be quite easily adapted.

Edit. Corrected typo in “path” in System Preferences per @mwra comment below.

SG

1 Like

Just to clarify, in macOS 10.14.x, I think the layout is slightly different as there is no ‘Privacy & Accessibility’ tab but just one for `Privacy’ on which there is a list box from which you choose ‘Accessibility’. You will likely have to give your admin password to get access to this list and add the apps as @sumnerg describes: