www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 3571b41d95651763f7b7291e2e6473163bf4ef4e
parent 3b0ee0285b049c375548882c3895d7303f9dc976
Author: Simon Kornblith <simon@simonster.com>
Date:   Mon, 12 Jul 2010 10:46:25 +0000

pick running copy of Word for Mac as AppleScript target


Diffstat:
Mchrome/content/zotero/xpcom/integration.js | 15+++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js @@ -111,12 +111,13 @@ Zotero.Integration = new function() { var background = Components.classes["@mozilla.org/thread-manager;1"].getService().newThread(0); var me = this; - function mainThread(agent, cmd) { + function mainThread(agent, cmd, doc) { this.agent = agent; this.cmd = cmd; + this.document = doc; } mainThread.prototype.run = function() { - me.execCommand(this.agent, this.cmd); + me.execCommand(this.agent, this.cmd, this.document); } function fifoThread() {} @@ -141,8 +142,9 @@ Zotero.Integration = new function() { var parts = line.value.split(" "); var agent = parts[0]; var cmd = parts[1]; + var document = parts.length >= 3 ? line.value.substr(agent.length+cmd.length+2) : null; if(agent == "Zotero" && cmd == "shutdown") return; - main.dispatch(new mainThread(agent, cmd), background.DISPATCH_NORMAL); + main.dispatch(new mainThread(agent, cmd, document), background.DISPATCH_NORMAL); } } @@ -224,7 +226,6 @@ Zotero.Integration = new function() { } else { // check to see whether there's a pyxpcom error in the console, since it doesn't // get thrown directly - var throwErr = true; var message = ""; var consoleService = Components.classes["@mozilla.org/consoleservice;1"] @@ -305,7 +306,9 @@ Zotero.Integration = new function() { var proc = Components.classes["@mozilla.org/process/util;1"]. createInstance(Components.interfaces.nsIProcess); proc.init(_osascriptFile); - proc.run(!!block, ['-e', script], 2); + try { + proc.run(!!block, ['-e', script], 2); + } catch(e) {} } } } @@ -698,7 +701,7 @@ Zotero.Integration.Document.prototype._updateDocument = function(forceCitations, var bibliographyText = bib[0].bibstart+bib[1].join("\\\r\n")+"\\\r\n"+bib[0].bibend; // if bibliography style not set, set it - if(!this._session.data.bibliographyStyleHasBeenSet && this._doc.setBibliographyStyle) { + if(!this._session.data.bibliographyStyleHasBeenSet) { var bibStyle = Zotero.Cite.getBibliographyFormatParameters(bib); // set bibliography style