Rename PDF that is drag and dropped on an item

Currently Zotero renames the PDFs that it exports from databases. In my opinion, this is one of the most helpful features. The problem is that if I drag and drop a PDF to an item from my computer, it does not not get renamed. If this was possible, zotero would be just about perfect PDF manager.
  • This has been a frequent request, and, as you know, part of what the user-created ZotFile plugin does. The problem is that not all files—and even all PDFs—dragged onto an item are necessarily full-content representations of the parent item, so doing this automatically for all dragged child attachments seems problematic. One solution would be, rather than doing this automatically, to offer a context menu option to rename based on the parent item, though that's still an extra step.
  • I agree with you that it depends on the context. I for example store entire books in Zotero as scanned chapters (very handy!). But for 99% of cases when I drag an item to Zotero, I would like to have it renamed. For me the optimal solution would be to have a configuration option to automatically rename PDFs. Then I could turn it of for the rare occasions when I do not want PDF to be renamed. Contextual menu option is the second best solution. I would not mind the extra step, since mouse cursor is already over the item after dragging.

    Zotfile is OK, but the Zotfile button often disappears from the panel making it unusable.
  • edited June 3, 2009
    +1 on this. It doesn't need to be automated because it's not really a batch-type workflow anyway, given that one would have to manually drag the attachment into Z pane. I've often wished that Zotfile or Zotero could, with a button or right-click (or preference pane as above), rename child attachments manually dragged into a parent item using the zotero or zotfile naming convention.

    This might also allow one to bring all PDF names into a single naming convention--I know mine are all over the place, some by Zotero, some by Zotfile, some dragged in from elsewhere, some from previous versions of Z with a different rename setting. I'd likely go through and rename everything so it searched and sorted properly if a "rename this attachment" function existed.
  • edited June 4, 2009
    Child file attachment renaming via a context menu option is supported in Zotero 2.0b5, available now. It uses the same format string (extensions.zotero.attachmentRenameFormatString) as translator-based saving. The customization options are rather limited at the moment, but they'll be extended.

    The attachment title is also changed if it was originally identical to the filename.

    Renaming of multiple files at once also works.
  • this seems broke in Linux (ubuntu 9.04)
    renaming actually works (although it doesn't seem that way), but the file is 'lost' afterwards and needs to be located manually. It then still appears with the wrong name.

    If you need a more extensive description let me know.
  • edited June 5, 2009
    Happy to see you guys added this... I do sort of wish it had come out a week ago so I hadn't spent last weekend writing a plugin to do exactly this... c'est la vie.

    However, just so I don't have to admit my weekend was completely fruitless, there are a couple of things I ended up adding that are worth considering:

    1. I've found that for my own use, I absolutely want this renaming to occur any time I drag/drop a PDF into an otherwise empty citation. I added an option so this can be disabled, but I have found it to be extremely useful in the past week.

    2. I often add things like supplementary material and such, and still want to be able to rename these within Zotero, though not according to the auto-naming rule of course. I added a simple prompt that allows arbitrary renaming, and also provides the metadata-based filename for convenience so you can copy/paste whatever parts you want into the new file name. I have found this to be a great time-saver as well.

    3. I also added an option to manually change the attachment title, which I have occasionally found necessary to clear up confusion with multiple PDF attachments in an article, or to generally clean up the window.

    4. Finally, I provided an option to automatically collapse all quick-search results. This one is obviously completely unrelated to renaming, but since I was writing an add-on and always wanted this feature I decided to add it. I know about the "-" key option, but I can honestly say that doesn't cut it, and I have been seriously thanking myself all week for adding this feature so you might consider doing so as well.

    Oh and in the options window for my plugin, I added a means of editting some hidden Zotero options that I think you guys really ought to expose: the renaming format string and the "launch non-native files" pref.

    Anyway thanks again for adding this feature. I suppose it wouldn't be the end of the world if you didn't immediately implement my suggestions, as it would give me a reason to advertise my plugin:

    http://umn.edu/home/kjamison/zoterename/
  • Keith - I like your suggestions and I like your plugin. Nicely done. The page that describes the features is also crystal clear. Thanks for sharing your plugin with the Community.
    -Alex
  • edited June 17, 2009
    adamsmith wrote:
    "this seems broke in Linux (ubuntu 9.04)
    renaming actually works (although it doesn't seem that way), but the file is 'lost' afterwards and needs to be located manually. It then still appears with the wrong name."

    Same behavior for me (Ubuntu 8.04, FF 3.0.11, Zotero 2.05b). File is renamed but the link does not get updated. If I then try to open the file through Zotero I get the option to locate it. Not too convenient right now since I want to autorename a large number of files (almost all my collection) and I can't go around updating every link manually.

    Any news on this issue?
  • I've been getting the problem adamsmith mentioned (on Ubuntu Jaunty) - only not consistently. I can't figure out precisely when it goes wrong, as often it works just as it should. Also, am running out of files to rename ...

    Regards
    Jon.
  • edited June 18, 2009
    Keith, with the nice goodies you´ve thrown in (like Collapse search results and a dedicated Zotero window) perhaps you should consider giving your plugin a more general name.

    Right now, automatic renaming of drag-dropped files doesn't seem to work for me (Windows XP, FF3.0.6, Zotero 2.05b). I've checked the preferences, the checkbox is selected. Also, "Rename attachment" gives me a prompt rather than renaming the thing automatically - is that right?

    (Meanwhile, the Zotero rename feature works fine. But I'd love automatic renaming upon drag and drop.)
  • Dan wrote:
    The attachment title is also changed if it was originally identical to the filename.
    I remember a thread about this distinction between attachment title and attachment filename (which is a little confusing to me). I would just like all attachment titles to be identical the filename. There is no option for this currently, is there? Keith, perhaps your plugin could address this? (I don't know how easy it would be to implement.)
  • Hi I've reported the error
    report id 212091638

    [JavaScript Error: "[Exception... "Component returned failure code: 0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) [nsIFile.lastModifiedTime]" nsresult: "0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)" location: "JS frame :: chrome://zotero/content/xpcom/data/item.js :: anonymous :: line 2537" data: no]" {file: "chrome://zotero/content/xpcom/data/item.js" line: 2544}]

    Firefox 3.5 Ubuntu 9.04, Zotero 2.0b5.r4654
  • The problem in Linux should be fixed in 2.0b6, available now.
  • Great, thanks Dan.
  • yes, just tried some out. thanks a lot!
    (now if that drag&drop from/to Zotero would also work...)
  • Hi,

    I would like to use this plugin, how do I install it?

    thanks for your time and help
  • See under "installation" at the plugin's home page.
Sign In or Register to comment.