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.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
build/src/libZoteroMacWordIntegration.xcodeproj
build/template/unpack_templates.sh
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...