Copy link to clipboard
Copied
I have a book contains 66 documents in which i want to find words which are incorrect and change it using the FindChangeByList.jsx sample script. But it crashes with error.
i am using this Change scripts to run through multiple documents in a book, rather than just the open document to load my Book but crashes with this error message pasted below
the code i used to run FindChangeByList is :
main();
exit();
function main() {
var myBook = app.open(File("C:\\Users\\sony.zacharia\\Desktop\\BCS\\Bible.indb")), myDoc;
$.writeln(myBook.name)
var myDocs = myBook.bookContents.everyItem().getElements();
for (var i=0; i< myDocs.length; i++) {
// must be adapted to your needs
myDoc = app.open(File("C:\\Users\\sony.zacharia\\Desktop\\BCS\\" + myDocs.name));
$.writeln (myDoc.name)
var myFile = new File ("C:\\Program Files\\Adobe\\Adobe InDesign CC 2017\\Scripts\\Scripts Panel\\Samples\\JavaScript\\FindChangeByList.jsx");
$.writeln (myFile.name)
if (myFile.exists) {
app.doScript(myFile, ScriptLanguage.JAVASCRIPT);
}
myDoc.close();
}
}
Please help me to sort this issue. Thanks in advance!
thank you so much @tpk1982 for your help! Actually the txt file i has had a list of words around 2600 words and i tried it using 160 words at a time and it worked. Feeling relieved that i have to only use script few number of times than actually finding and replacing the words. huh!
Copy link to clipboard
Copied
Two things..
1) Avoid using $.writeln()... because it will open the extendscript application unnecessarily.. just delete or comment it
2) Why the path contains double slashes? ( var myFile = new File ("C:\\Program Files\\Adobe\\Adobe InDesign CC 2017\\Scripts\\Scripts Panel\\Samples\\JavaScript\\FindChangeByList.jsx"); )
Copy link to clipboard
Copied
1) i will change all the occurrence written for console. 2) i found out using double slash \\ from some discussion as single slash was not read for path
Copy link to clipboard
Copied
Double slashes using for searching anything in grep search.. not for path.. i hope
You can use the single slash is enough
Copy link to clipboard
Copied
one more remark when i run FindChangeByScript.jsx in one single document then also the same Error:25 is coming up. š
Copy link to clipboard
Copied
app.doScript(myFile, ScriptLanguage.JAVASCRIPT); i think the problem is with this line. Am i using it correctly? I am a beginner in indesign. Don't have any experience with this kind of work. š
Copy link to clipboard
Copied
I mostly used doScript for calling internal functions.. but yes we can call the script.. i hope the other experts in this forum will guide you..
But the below thread will help you.. is it you posted a part of script or entire one?
Re: User-defined Objects as Arguments to app.doScript()
Code to be evaluated! [016] Tabs Position! ā¦
Suppress dialog when executing jsxbin file from app.doscript
Copy link to clipboard
Copied
thank you so much @tpk1982 for your help! Actually the txt file i has had a list of words around 2600 words and i tried it using 160 words at a time and it worked. Feeling relieved that i have to only use script few number of times than actually finding and replacing the words. huh!
Copy link to clipboard
Copied