Zotero commandline, or, How I Learned to Stop Worrying and Love the MozRepl
- Got Zotero? Good.
- Install MozLab.
- Restart Firefox.
- Start MozRepl.
- Open a terminal.
- telnet localhost 4242
- Get the Zotero object:
var zotero = Components.classes["@zotero.org/Zotero;1"] .getService(Components.interfaces.nsISupports)
.wrappedJSObject;...but all on one line, no spaces before the dots. Sorry, my formatting plugin went b0nkr5.
- Surprise your friends, amuse your enemies, bore the big-Zotero-collectionists:
repl> for each (item in zotero.Items.getAll()) {
....> alert(item.getField("title"));
....> }
Pretty nifty, eh?
Trackback URL for this post:
http://onebiglibrary.net/trackback/256
Jodi Schneider (not verified) on June 01st 2008
Need a consistent variable name (one of Zotero OR z)
e.g.
OR
for each (i in Zotero.Items.getAll()) {Thanks for the tip, Dan! Going to take a closer look at http://dev.zotero.org/interacting_with_zotero_from_within_firefox now!
dchud on June 01st 2008
Fixing now. Thanks!
alf (not verified) on June 02nd 2008
If you figure out how to get Firefox/Zotero running on a remote server, that would be very useful.
dchud on June 02nd 2008
When you say "running on a remote server", what do you mean? Yesterday the folks at the Zotero mothership (CHNM) did a lovely semi-public demo of syncing to their server, so that's coming, for one, and you can see that happen in the 1.5 betas.
Do you want to be able to interact with a Firefox/Zotero running on another machine? If so I think you could do it this way, just ssh over and telnet once you're there. (You wouldn't want to expose the MozRepl port outside a firewall, right?)
Graham Fawcett (not verified) on June 04th 2008
Very nice, Dan -- thanks for this!
Post new comment