• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Run FindChangeByList script using another script to load in a book

Community Beginner ,
Mar 10, 2017 Mar 10, 2017

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 ErrorScrn.png

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!

TOPICS
Scripting

Views

826

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Mar 10, 2017 Mar 10, 2017

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!

Votes

Translate

Translate
Guide ,
Mar 10, 2017 Mar 10, 2017

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"); )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 10, 2017 Mar 10, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 10, 2017 Mar 10, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 10, 2017 Mar 10, 2017

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. šŸ˜ž

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 10, 2017 Mar 10, 2017

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. šŸ˜ž

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 10, 2017 Mar 10, 2017

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 file to folder in applescript inside javascript

app.doscript Error

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 10, 2017 Mar 10, 2017

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Mar 13, 2017 Mar 13, 2017

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines