wshanks / Zutilo

Zotero plugin providing some additional editing features
Other
1.53k stars 72 forks source link

Is there a way to copy attachments from selected items? #68

Closed karakatsanism closed 7 years ago

karakatsanism commented 7 years ago

Hello, I am using zutilo 2.0.2 along with latest Zotero 5 beta. Is there any way to select an number of items and copy their attachments (files)? thanks

wshanks commented 7 years ago

Hmmm, Zutilo has a function that can copy the full paths to the attachments to the clipboard as a list of strings (separated by new lines I think). Do you want the files copied to the clipboard the way they would be copied if you copied them in a file browser? It may be possible to do that, but my quick internet searches did not turn up an easy solution.

What operating system are you using and which programs do you want to copy attachment files to the clipboard for? For a quick solution, it may be possible to use the current copy attachment paths function with a script that can read the clipboard and mimic pasting them where you want to paste them.

karakatsanism commented 7 years ago

Hi and thanks for the answer. Yes, actually I want to mimic the file browser behavior.

I am using windows 10 and I am trying to do this in order to paste the items in a XYplorer paper folder (great file browser btw) in order to tag them in XYplorer. Your suggestion for a script sounds feasible, I could ask in the XYplorer forum too... thanks anyway

wshanks commented 7 years ago

XYplorer looks pretty scriptable and seems to have access to the clipboard, so I think it should be pretty easy to make a script in there that can loop over the clipboard contents and do a file copy on each path in there. I'm not familiar with XYplorer though, so I can't suggest the exact commands to use.

I think this should be possible to do in Zutilo as well, but we'd have to figure out how to write to the clipboard with metadata rather than just plain text. One reason not to do this right now is that Zotero is planning to transition from a Firefox base to an Electron base, so spending time figuring out how to do this in Firefox might be a waste. I found this one issue related to working with file paths in Electron. It seems like there is no built in API for file path clipboard metadata but it might be possible to handle different OS's by hand in the code (the response in the issue suggests how to read paths in OS X and Windows; there's probably a way to write them as well):

https://github.com/electron/electron/issues/9035

karakatsanism commented 7 years ago

Hi, I actually manage to make a script in XYplorer for my needs. Thanks again for your time and help.

wshanks commented 7 years ago

Great. I will close this for now, but if anyone's interested in the future it could be re-opened. It might be easy to do by the time Zotero is based on Electron.