Sending annotation to DTTG

Hi

I know nothing about python so apologies if I’ve missed something. I copied and pasted your code into a pythonista script.

However when I run it I get an error from
line 15 title = searchTitle.group(1).

It says ‘NoneType’ object has no attribute ‘group’

Is there an easy fix?

kind regards

Michael

I have to admit that I am not using this script these days as I am doing my annotations in PDF Expert and then using a Workflow.app workflow to convert the annotations to Markdown and export to DevonThink. The problem in the above script can be corrected by changing the below line:


searchTitle = re.match('Notes\sin\s(.*)\.pdf',stripReturn

to the following:


searchTitle = re.match('Notes\sin\s(.*)',stripReturn)

thanks… I’ll try it. Although pdf expert and a workflow sound even better. Is it in the workflow directory on the website?

cheers

Michael

In PDF Expert you need to ‘save a copy’ of your annotations (found under the ellipsis menu) as an ‘annotations summary’. PDF Expert will then create a rich text file of your annotations. You can send this directly to DevonThink or you can run the following Workflow https://workflow.is/workflows/d056118836314d15b5c6f1ddca7e3725 which will convert the annotations summary to a Markdown formatted file.

This is very timely and very welcome! I’ve just been trying to work my way through a process to integrate DTTG (good at making and searching PDF annotations) and DTPO (not good at making and searching PDF annotations at all) and I’ve just reached the ‘Trying PDF Expert because that works on iPad and Desktop’ approach after spending some time in the Highlights (crashes all the time) and Skim (too much faff converting annotations) cul-de-sacs.

Your workflow rounds it all off very nicely – thank you!

I’ve just amended in one small way – the file it produced for me was plain text (.txt), so that DTTG doesn’t trigger the Markdown preview. Of course you can convert it in DTTG but it’s an extra step.

I managed to set the output file to be markdown by adding .md as straight text after the Group from Matched Text variable in the Set Name section, keeping Don’t Include File Extension (in Advanced) as unset.

This seems to work – the annotations are now recognised as Markdown in DTTG by default.

Thanks very much for the workflow – I mention the amendment only because it took me about 20 minutes to work out how to do it, so I thought it might help someone who’s also new like me to Workflow.

1 Like

Hi
thanks for all the advice. It all works.

In an ideal world I’d be capturing each note as a separate snippet in Devonthink ultimately all grouped with the original text. And of course I’d be able to grab figures. That’s what Sente used to allow with a script to post to Devonthink.
But at least I’ve got back to a point where all the annotations are getting into Devonthink

So now I actually have to do some work instead of fiddling :unamused:

Michael

Following all this with great interest (like many here, a “Sente refugee”). I also would love to hear if the annotations can be saved somehow (through workflow?) as separate text files and sent directly to DT. My current workflow is to annotate in PDF Expert, send back to Bookends, then run a script from there to split them into individual files back on my Mac machine (which are then imported to DT). But if we could avoid that step…oh happy days! :stuck_out_tongue:

This is possible with Workflow.app. For example the following workflow will take annotations in PDF Expert (as described above), split the annotations into seperate markdown files based on the quote, name the files with the first few words of the quote, send each quote (and any notes associated with that quote) through to a group in DTTG named ‘Annotations of name of PDF’ . The group is saved in an inbox or another group of your choosing, although you will need to adjust the workflow to insert the UUID of the inbox in DTTG that you want the grouped annotations to go to (the UUID are the numbers in a Devonthink item link).

The workflow is here: https://workflow.is/workflows/b9ce3e4bc1e24a24aac29b1929f82ddf

Wonderful! Thanks so much. Is it greedy to wonder if the page number can be inserted as well?

That is doable - you would need to adjust the REGEX command in the workflow that searches for the highlights and notes. In the workflow there are two ‘Replace Text’ actions near the beginning of the workflow. In the first one replace the ‘Find Text’ expressions with:


highlight \[(.*)\]\:

And then in the ‘Replace With’ field underneath write:


> $1

In the second ‘Replace Text’ action replace the ‘FInd Text’ field with:


note \[(.*)\]\:

And in the ‘Replace With’ field underneath write:


$1

You will then get your page numbers in the Markdown files and your files will be named with page number first followed by the first few words of the file

Wow! This is great — thanks for your time with this.

Hi again

Thanks. Both the pdf expert export using workflow and the liquidtext python script work. The pdf expert is nicer in that you get separated snippets for eac note. But of course neither do mages.

Have you found a way using either PDF expert or liquidtext to clip import tables and figure to DEVONthink?

Cheers

Michael

PDF Expert currently doesn’t allow selection of non-text items. In LiquidText you can select non-text items and export the annotation summary manually to DTTG as a DOCX document, which should include diagrams

Hi

you are absolutely right - liquid text is the only pdf reader I’ve come across on iOS that allows image selection. I’ve had some success using it with copied (an app which manages the clipboard history and syncs it across all your devices) but it is quite labour intensive. I’ve put in a request with Readdle to consider adding non-text selection… here’s hoping.

Ultimately I am aiming for the following:

  • something that works across iOS (including phone) and macOS
  • the ability to easily mark annotations within the pdf file: text but also images and tables/figures
  • the ability to add comments to the pdf
  • then to be able to save all those quotes/comments/images to Devonthink as individual snippets stored within a group specific to the source (linked back to the original source which is in Bookends in my case)

The point of saving everything in the pdf file is that it will be more robust than having extra annotation files. The reason for using Devonthink is to be able to locate things easily in the future.

It seems like this is the workflow everyone is more or less heading towards. There are tools around that do all the individual bits, (if stuck together with scripts and workflows). But nothing does everything. Sente and the Sente2Devonthink scripts came closest - but are sadly no longer with us.

For now I think I’m stuck using pdf expert for text annotations and doing the extracting on my iPad (unless anyone knows of a script on MacOS that does the same as the workflow you kindly linked). I’ll have to put comments in saying there is an important figure to grab and at some point grab them on my desktop with highlights or preview and copy them by hand into a media file in the group where the comments for the reference are.

I have considered running Devonthink and a pdf reader in split screen on the iPad and manually creating annotations in Devonthink as I read. But anything which gets in the way of actually concentrating on what I’m reading makes it hard to get to grips with the material.

Anyway, thanks for your help. I’m going to check back on this thread regularly and see if anyone has any new bright ideas

M

An update…liOS 11 addresses nearly all the issues! I’m annotating PDFs in PDF expert for text and extracting annotations to DTTG via the workflow. I’m using the iOS screen capture and crop function to capture figures. I then share these to a list for the article in Copied (clipboard management app). This is very seamless. Finally I dump the list of clippings from copied into the group generated in DT by the workflow that extracts the text annotations. Sounds complicated but it really isn’t. And it’s effortless.

Cheers

M

Hello Kseggleton,
very interesting…how do you manage the same workflow in DT? I mean, now that Liquidtext has a Mac version, I tend to finish the annotation part with my iPad and after I open the Liquidtext project on my mac and export. But in which format do you import the pdf in DT and how you extract the annotations and excerpts? Thanks!

I have stopped using Liquidtext some time ago. These days I annotate in Bookends and then export into DT with some applescripts

Ok thanks anyway!

I find LiquidText to be better in concept than execution for my specific needs — more than one thing open is good for my own distilled thoughts, but hardly ever source material itself.

Maybe try Highlights App.

It has two ways it works with DTTG really well. The first is my workflow:

Way one:

  • Get pdf, file in DTTG
  • (whatever here for housekeeping — I group it with a plaintext citation)
  • Share, open with Highlights
  • Make your annotations and share back to DT as a marked up PDF or a markdown file with formatted excerpts and notes

Way two
Just enable DTTG in files app, open the pdf from DTTG’s file container in Highlighs, make your markup directly in it. You will have to share back the note/excerpt markdown to plaintext.

There’s some features in Highlights that you can get really nerdy with. It has different colors of highlighters, so I have green as statements of fact, yellow for conclusion, etc — you can configure it to export those grouped by color category or simply in reading order. Both have purpose.