Copy link to clipboard
Copied
Hello, I followed a Lynda.com tutorial to convert tagged text into paragraph styles: Converting tagged Word docs to styled InDesign text with a script
I edited the FindChangeList.txt file to include the tags that I need to convert. I edited in plain text editor. However, with the additional text, I am now getting Error Number 8. After some googling, it seems likely that the problem is not in the .jsx file but in the text file. I tested by deleting the new text, and when I did so, there was no javascript error. Of course, the tagged text didn't change. Any advice as to how to correct my txt file would be much appreciated!! See below for the complete edited file with the additional text at the bottom in red (<ParaStyle:ti> etc.):
//FindChangeList.txt
//A support file for the InDesign JavaScript FindChangeByList.jsx
//
//This data file is tab-delimited, with carriage returns separating records.
//
//The format of each record in the file is:
//findType<tab>findProperties<tab>changeProperties<tab>findChangeOptions<tab>description
//
//Where:
//<tab> is a tab character
//findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).
//findProperties is a properties record (as text) of the find preferences.
//changeProperties is a properties record (as text) of the change preferences.
//findChangeOptions is a properties record (as text) of the find/change options.
//description is a description of the find/change operation
//
//Very simple example:
//text {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double dashes and replace with an em dash.
//
//More complex example:
//text {findWhat:"^9^9.^9^9"} {appliedCharacterStyle:"price"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Find $10.00 to $99.99 and apply the character style "price".
//
//All InDesign search metacharacters are allowed in the "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences.
//
//If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped"
//as shown in the example below:
//
//{findWhat:"\\s+"}
//
grep {findWhat:" +"} {changeTo:" "} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double spaces and replace with single spaces.
grep {findWhat:"\r "} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns followed by a space And replace with single returns.
grep {findWhat:" \r"} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns followed by a space and replace with single returns.
grep {findWhat:"\t\t+"} {changeTo:"\t"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double tab characters and replace with single tab characters.
grep {findWhat:"\r\t"} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns followed by a tab character and replace with single returns.
grep {findWhat:"\t\r"} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns followed by a tab character and replace with single returns.
grep {findWhat:"\r\r+"} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double returns and replace with single returns.
text {findWhat:" - "} {changeTo:"^="} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all space-dash-space and replace with an en dash.
text {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all dash-dash and replace with an em dash.
text {findWhat:”<ParaStyle:ti>”} {changeTo:" ", appliedParagraphStyle: “Title”} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
text {findWhat:”<ParaStyle:st>”} {changeTo:" ", appliedParagraphStyle: “Subtitle”} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
text {findWhat:”<ParaStyle:au>”} {changeTo:" ", appliedParagraphStyle: “Author”} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
text {findWhat:”<ParaStyle:pr>”} {changeTo:" ", appliedParagraphStyle: “Price”} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
text {findWhat:”<ParaStyle:series>”} {changeTo:" ", appliedParagraphStyle: “Series”} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
Make sure you use a plain text editor to edit the text file. It looks to me like you might be introducing curly quotes into the code which would make it fail:
This is correct:

But this will not work:

Copy link to clipboard
Copied
Make sure you use a plain text editor to edit the text file. It looks to me like you might be introducing curly quotes into the code which would make it fail:
This is correct:

But this will not work:

Copy link to clipboard
Copied
Goodness gracious, it worked! Thanks so much. Weirdly, I edited the .txt file in Text Edit (Mac) but for some reason it inserted curly quotes. I guess I am surprised it did that.
In any case, thanks again for your help!
Copy link to clipboard
Copied
You can also use ExtendScript Toolkit for this and save out with the .txt extention. The color coding makes it easier to see code violations:

Copy link to clipboard
Copied
In Mac TextEdit, you have to go into Preferences and set the thing to Format: Plain Text, and you also might try to turn off Smart Quotes.
On the other hand, I would download and install any one of many nice text editors. I have often used Sublime Text.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more