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.
- MacOSX10.7.sdk symlinked to
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
- XCode 8.2+
- Launch the project in
build/src/libZoteroMacWordIntegration.xcodeproj
- Product -> Build For -> Profiling
- Templates should be built with the oldest version of Word to be supported. Otherwise older versions of Word may fail to function properly. This is currently:
- Word 2016 (for the ribbonized dotm template)
- Word 2011 (for the old dot template)
- Open the template from inside Microsoft Word
- Go to View->Macros->View Macros (Ribbonized Word) or Tools->Macros->View Macros (Word 2016) and click "Edit" for one of the Zotero macros
- Edit/replace code as desired
- Go to Debug->Compile Project to ensure there are no code errors
- Run
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...