Can Zotero count the pages of my library?

Specifically, I'm writing a bachelor project and I need 1750 pages of literature. Is there any way that zotero can tell me how many pages of literature are in a given folder, assuming, of course, that the "pages" field is filled out correctly? It doesn't look that way, but I'm hoping that maybe someone wrote a plug-in somewhere.
  • It can be done in one or two lines of JavaScript, but I'm not aware of any plugins that do this. If you let me know if you're running Zotero for Firefox or Zotero Standalone, I can tell you how to calculate this manually.
  • Well, any kind of automation would be preferable to doing it manually, so if you can show me how to do it with JavaScript that would be Awesome! I am running Zotero Standalone.
  • OK, see the Zotero Standalone instructions for reporting startup errors:

    https://www.zotero.org/support/reporting_problems#reporting_startup_errors

    (Basically, this tells you how to start Zotero with the Error Console open.)

    Once you have Zotero with the Error Console window open, open the collection in question. Then, in the Code line at the top of the console window, paste this in:

    Components.classes["@zotero.org/Zotero;1"].getService(Components.interfaces.nsISupports).wrappedJSObject.getActiveZoteroPane().collectionsView.getSelectedCollection().getChildItems().reduce((x, y) => x + y.getField('numPages'), 0)
    Press return or click Evaluate, and you should see the total pages for items in the current collection at the bottom of the console.
  • Cool, that seems to be working, but unfortunately only for books and I really needed it to work for articles and/or book sections. I guess it becomes a little more complicated, as the pages field is written "22-33", so I would need to subtract 22 from 33, add 1, and then make a sum of all the results. Is that fairly doable?
  • Yeah, that's a different field — the 'pages' field isn't the same as 'numPages'. This is totally doable, but it's getting beyond what can be done in a single line or what we can provide support for. You or someone else would have to write a little bit of JavaScript to do this — sorry.
  • No worries, I already figured it might be too much to ask for, so I'm just thankful for the help that you did give me. I don't have the skills with JavaScript to write the necessary code, unfortunately, but I do have a backup plan involving custom bibliographies, regular expressions, and Excel sheets. I suspect it might be easier to count by hand, but where's the fun in that ;)
Sign In or Register to comment.