Unable to bulk import a list of urls

  • @adamsmith

    Yes I have tried many different ways to fix the file path error and I even included an absolute path to the text file, but I was still unable to fix the problem.

    Is there a different way to indicate the filepath with Windows?

    This is what is going into path url right now: "C:\Users\my_user_name\Desktop\text_file.txt"

    The rest of the code is the same.
  • For a Windows path you need to use two backslashes for each backslash (because backslash is an escape character).
  • @dstillman
    That's it! Thank you so much!
  • Hi everyone,

    I'm trying to use the javascript code as well but keep getting the same mistake as above:

    var path = '/Users/bruno/Desktop/articles.txt';
    var urls = Zotero.File.getContents(path).split('\n').map(url => url);
    await Zotero.HTTP.processDocuments(
    async function (doc) {
    var translate = new Zotero.Translate.Web();
    var translators = await translate.getTranslators();
    if (translators.length) {
    try {
    await translate.translate();
    catch (e) {}
    await ZoteroPane.addItemFromDocument(doc);

    [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIFile.initWithPath]" nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)" location: "JS frame :: chrome://zotero/content/xpcom/file.js :: Zotero.File</this.getContents :: line 159" data: no]

    What can I do?
  • Sorry, I forgot to say: I used two backslashes as well.
  • I managed to make the code work, but have bumped into another issue: whenever it encounters a broken link it just stops, instead of continuing forward. What should I do?
Sign In or Register to comment.