zotero / zotero-word-for-mac-integration

Zotero Word for Mac integration
https://www.zotero.org/support/word_processor_plugin_usage
Other
24 stars 12 forks source link

Zotero Word for Mac Integration

This is a Firefox add-on that consists of a library written in ObjC that communicates with Microsoft Word out of process using AppleScript, a js-ctypes wrapper for said library, and a template that is installed into Microsoft Word to communicate with Zotero.

ObjC Library Build Requirements

To Build the ObjC Library

Template Build Requirements

To Modify/Build the Templates

Development Starter's Guide

Start by opening the dotm/dot template in Word. Word templates have support for custom macros and adding UI elements to call the macros, which is how the extension is implemented on Word. RibbonUI can be edited by extracting the dotm file. To edit the .dot template UI Word for Windows 2003 is needed. In VBA Macros code you will see that calls to Zotero are executed by writing commands to a file named .zoteroIntegrationPipe. The command format is:

echo "MacWord2016 <commandName>" > $PIPE

The pipe is created in zoteroMacWordIntegration2016Pipe.js for Word 2016 or integration.js for Word 2011 and older, and requests are handled in integration.js.

Zotero talks to Word via js-ctypes bindings to an ObjC library. The ObjC library itself utilises ScriptBridge to call AppleScript commands and interact with a running Word process. Header files, such as Word.h, are generated by running

sdef /Applications/Microsoft\ Word.app | sdp -fh --basename Word

as explained in Scripting Bridge Programming Guide. AppleScript command definitions can be found within ScriptEditor > File > Open Dictionary...