Copy link to clipboard
Copied
Hello,
First - I am new to scripting.
I have been doing manual find/replaces on some documents I have and thought this should be a slam dunk for the find/replace script in InDesign, but I am getting an error and not sure why.
Here is the error:
All I have done is add the first four lines to the list of find/changes in the supporting text file (file attached) and added // in front of the existing/default ones so they are ignored.
I'll admit the find/replace operations I am using are not very sophisticated, but they achieve my exact desired ends and save me a ton of time - to be able to run them all in order at the click of a button would be even better.
Your help is appreciated.
Baxter
Every field has to be seperated with a single tab character in two of your records the changeTo is preceded by I suppose double tabs and hence the issue. Fix it and it will work. Check the file which worked for me
-Manan
Copy link to clipboard
Copied
Change double return to single return
Change returns to XX
I'm not a JS expert but should't comments like the ones above be commented? Right now they appear as part of script code.
Copy link to clipboard
Copied
the attached file is the .txt support file, not the script itself, and that seems to be the correct formatting looking back over several versions.
What's strange is the script doesn't seem to have changed in years, and the error seems to be in the running of the script. Only thing I see different in the text file is the samples all end the comment with a period, but the new entries do not.
Copy link to clipboard
Copied
I have just spent some time with this - stripped the txt file back to bare minimums and started building it one by one. Oddly enough I got some lines to work by themselves, then later they would fail? Scripting and programming is well above by head, but this seemed pretty straightforward.
As a work-around, I have just created custom find/replace actions, named them, 1, 2, 3, 4, etc and just serially click through them and Change All. That is much quicker than I was doing, so I'll take a small win for now.
I'll have to research this scripting more later.
Many thanks for the comments.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It's the txt file in the original post. At the bottom.
Copy link to clipboard
Copied
just out of curiosity, have you tried adding a period to the end of each new line?
Copy link to clipboard
Copied
I haven't, but will absolutely give it a try. Thanks.
Copy link to clipboard
Copied
Every field has to be seperated with a single tab character in two of your records the changeTo is preceded by I suppose double tabs and hence the issue. Fix it and it will work. Check the file which worked for me
-Manan
Copy link to clipboard
Copied
Good catch @Manan Joshi.
Copy link to clipboard
Copied
Briiillliant! Thank you! Yes, I see the issue now. I went back and cleaned things up and the script works just fine now! You have saved me a lot of time, my friend - I learned something today.
Cheers
Copy link to clipboard
Copied
You should use some Text Editor that let you control TABstops and show them - this is a screenshot from Notepad2:
Here they are set to 10 - I had them set to 4 before and missed the doubles.
Copy link to clipboard
Copied
Excellent - thank you. I will look into that type of editor. Easy to see the inconsistencies in that type of view.
Copy link to clipboard
Copied
Almost all editors have this option of showing hidden characters. So check if your current editor has it and if yes then switch the option on and you are all set.
-Manan