3 Replies Latest reply on Jan 15, 2018 10:44 AM by [Jongware]

    readFileLineByLine

    perezmray Level 1

      I have a script that I am using for INDD on a mac that uses the readFileLineByLine function:

       

      readFileLineByline('/Users/Administrator/Desktop/text.txt',doSomethingWithTextRow);

       

      jserror.png

      In other examples the file path is enclosed in single quotes. I have tried double quotes, no quotes as well as /Volumes/Users/Administrator~

      Any help is greatly appreciated.

        • 1. Re: readFileLineByLine
          [Jongware] Most Valuable Participant

          Look carefully. They are not the single quotes that you get from your keyboard, but 'typographically correct' curved single quotes. That's the problem that InDesign reports.

           

          Usually this happens when you copy a script out of a document or web page that applied 'text enhancements', and it can easily be fixed by replacing them in your local code editor.

           

          However! Since you also say "I have tried double quotes", then I'm going to suggest that the problem is at your side, and it's your code editor that keeps curling your quotes. Better check that first.

          • 2. Re: readFileLineByLine
            perezmray Level 1

            Thanks, Jongware! I am not used to using a mac and the TextEditor was curling the quote (font was so small, I didn't notice it). Works fine now.

            • 3. Re: readFileLineByLine
              [Jongware] Most Valuable Participant

              TextEditor is not the best possible code editor. You can also look at TextWrangler and Sublime Text – I use both, off and on. They each have their idiosyncrasies (= both unexpected included and not-included features) but either should do much better than that ol' jack of all trades, master of none TextEditor.