For my workflow it would be great to copy an element in Zotero and paste it as clickable link into Evernote, ideally using the title as text and the Zotero select URI as target. This could only be possible if the function of Zotero that copies text to the clipboard supports formatted (i.e. RTF) content. Usually the clipboard contains several data formats when copying something. If you e.g. copy text from a website containing a link the plain text is stored in the clipboard and additionally there is a version preserving the links, font style and color. Now when you paste the contents e.g. into Microsoft Word, all the formatting will be shown as it was on the website. In notepad only the plain text will be visible. The Zotero (export) translator will always fill the plain text area of the clipboard. Based on my experiments even RTF text with a valid RTF header written to the output won't be recognised as RTF text when pasted into Word or Evernote.
So, what can we do? The first step was to change the output of the Zotero export translator (quick copy) as you can see here. The output now contains at least the Zotero select URI and the title (e.g.
<a href="zotero://select/items/0_KJ6MZWKT">CloudML</a>). Then I found the shell command
textutil which is able to convert HTML to RTF. You can try the following command in the Terminal which converts an HTML link to RTF and copies the result into the clipboard. Pasting in Word or Evernote will result in a clickable link to Google.com with the text "Test".
echo "<a href=\"http://www.google.com\">Test</a>" | textutil -stdin -stdout -format html -convert rtf | pbcopy
Now that we have a way to get HTML links out of Zotero and found a tool to convert HTML to RTF it's time to put everything together. Automator is a tool in OS X that enables the creation of custom services and workflows. I use it to create a service running a shell command for which a keyboard shortcut can be assigned later on. It's straightforward: Create a service, select "Run Shell Script" and add the command.
It is very important to set the encoding of the shell environment first because it's not set to UTF-8 as it might be in your Terminal. This is the command I eventually used (Set encoding, use the contents of the clipboard as input for
textutil and then save the output in the clipboard):
export LANG=de_DE.UTF-8; pbpaste | textutil -stdin -stdout -format html -convert rtf -inputencoding utf-8 | pbcopy
When you save the workflow it's available in this menu: System Preferences > Keyboard > Shortcuts. In the services category you will find your newly created service and can assign a keyboard shortcut.
This is my upgraded workflow with the goal to create clickable links in Evernote pointing to Zotero entries:
- Select entries in Zotero, press CMD+Shift+C to copy the HTML links
- Press CMD+CTRL+Shift+C to convert the HTML code in the clipboard to RTF
- Paste links in Evernote