JavaScript Error (TypeError on constructors)

I'm trying to do a search and replace as described undir the JavaScript API (http://www.zotero.org/support/dev/client_coding/javascript_api)

But every code I run gives me the error message: TypeError Zotero.Search is not a constructor.

I've tried a very basic code like var myItem = new Zotero.Item; and it still gives me TypeError Zotero.Item is not a constructor.

I'm using Firefox 22.0 with the Zotero and ExcecuteJS extensions.
  • a very basic code like var myItem = new Zotero.Item;
    Why ?
    Just follow these instructions for batch editing: http://www.zotero.org/support/dev/client_coding/javascript_api#examplebatch_editing
    Unless you'd like to do something else ?
  • eh yeah. That's the code I've been trying to run (as stated in my post). But I get the error message: "Zotero.Search is not a constructor"

    I think it has something to do with not getting the Zotero class.
  • It works for me (z 4.0.8.Source but that shouldn't be an issue). You didn't change anything in the script ?
    In Execute JS, the target window must be "Zotero -Mozilla Firefox" and you should uncheck the "Content Window" box.
  • Hmm I'm not getting "Zotero-Mozilla Firefox" as an option for target window. I get this current window as an option and then Execute JS.
    So the problem is that i'm within the wrong scope?

    Any ideas why Execute JS is not giving me Zotero as an option?
  • Update: It seems to be reading the Zotero class. When I change the target window to ExecuteJS I get the error "Zotero is not defined". Having the target window on a Mozilla Firefox window gives the error message "Zotero.Search is not a constructor"

This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.

Sign In or Register to comment.