Skip to content

Instantly share code, notes, and snippets.

@cfriedline
Last active August 30, 2020 01:54
Show Gist options
  • Save cfriedline/0b2f5ab92aec3f5bf0dc to your computer and use it in GitHub Desktop.
Save cfriedline/0b2f5ab92aec3f5bf0dc to your computer and use it in GitHub Desktop.
WIP: Migrating from Sente 6 to Papers 3 via Endnote XML export

#This is a work in progress: YMMV (I'm working on an AppleScript supplement, so stay tuned...)

Migrating from Sente 6 to Papers3 via Endnote XML export

This process will export all of the references from Sente to an EndNote XML library suitable for import into Papers3. With a little shell magic, it will also set up the PDFs

Export

  1. Select all references in Sente
  2. File | Export | EndNote X | sente_endnote.xml

Change file paths

sed -i .bak 's/file:\/\//file:\/\/localhost/g' sente_endnote.xml    

Import into Papers

  1. Create a new papers library (if necessary)
  2. File | Import | EndNote XML Library | sente_endnote.xml
  3. Wait...

Configure Papers

Library orgnization, syncing, etc...

This has been tested with Sente 6.7.7 into Papers 3.2.0

Issues

  1. For some reason, potentially malformed file names in the EndNote export may fail to import. If that fails, the following procedure may work.

    1. Install bibutils from http://sourceforge.net/p/bibutils/home/Bibutils/

    2. Convert sente_endnote.xml to BibTex

      endx2xml -x sente_endnote.xml > sente_endnote.xml.temp

      xml2bib -sk -b sente_endnote.xml.temp > sente_endnote.bib

    3. Replace file:// with file://localhost

      sed -i .bak 's/file:\/\//file:\/\/localhost/g' sente_endnote.bib

    4. Replace %20 with spaces

      sed -i .bak2 's/%20/ /g' sente_endnote.bib

    5. Import the BibTex into Papers3

@mdeweerdt
Copy link

mdeweerdt commented Oct 6, 2017

Good work. Thank you for sharing. Perhaps an additional hint: to also import keywords, make sure to check the box under Options upon file selection in Papers 3 to "Import and Convert Endnote to Papers keywords".

@mdeweerdt
Copy link

mdeweerdt commented Oct 8, 2017

I've got another suggestion, based on my experience that when there are multiple attachments, only the first one is imported by Papers3. I think that if the first one is a "webarchive" and the second a "pdf", you may want the pdf. This can be achieved by the following line:
sed -i .bak -E 's/<urls><related-urls><url><style[^>]*>([^<]+)webarchive<\/style><\/url><url><style[^>]*>([^<]+)pdf<\/style><\/url>/<urls><related-urls><url>\2pdf<\/url>/g' sente_endnote.xml

Similarly, for removing a first attachment with a http URL while there is a second one with a file URL:
sed -i .bak -E 's/<urls><related-urls><url><style[^>]*>(http[^<]+)<\/style><\/url><url><style[^>]*>(file:[^<]+)pdf<\/style><\/url>/<urls><related-urls><url>\2pdf<\/url>/g' sente_endnote.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment