Skip to content

copying to clipboard Zotero citations as HTML w/ chickenfoot

Here's a first pass at a Chickenfoot script that copies selected Zotero items as HTML to the clipboard.  (I couldn't find anything in the Zotero interface to do exactly this function.  There is a  Create Bibliography from Selected Item(s)->Copy to Clipboard but that seems to copy citations as RTF for me.)

var Zotero = chromeWindow.Zotero;
var ZoteroPane = chromeWindow.ZoteroPane;
var zfi = chromeWindow.Zotero_File_Interface;

// zfi.bibliographyFromItems();

// create the bibliography out of the default style 
// and copy directly to clipboard w/o any popup windows.

// get the default style
var style=Zotero.Prefs.get("export.lastStyle");

// e.g., http://www.zotero.org/styles/chicago-note-bibliographystyle

var items = ZoteroPane.getSelectedItems();
zfi.copyItemsToClipboard(items, style);

For more details, you can look at how Zotero_File_Interface is defined in v 1.0.9 to study copyItemsToClipboard.

Post a Comment

You must be logged in to post a comment.