Copy link to clipboard
Copied
Hi there, I wrote a batch-processing script for find change queries and thought I share it with you. You can get it over here
You can process GREP, TEXT, GLYPH and OBJECT searches.
While creating books in InDesign with several documents we always come across some find change queries that need to be used again, and again, and again. To make this process easier you can just grab their names and put them into a list. The script will than try to process all your queries in one click.
text.files = []
, grep search goes into grep.files = []
and so on. Make shure to remove the .xml from the filename. You can find these files on:Tom's Obvious, Minimal Language is a simple markup language that makes settings human readable. It is still in development and may change a lot. But still. It is a pretty easy language and can be learned by anyone.
The basic toml filer looks like this:
# these are the basic settings
# the MUST be there
do_text = true
do_grep = true
do_glyph = true
do_object = false
# now the file names
# they have to be in one line
# the toml specs say you can break lines in arrays
# but the toml.js does not allow that at the moment
[text]
files = ["my_first_text_find_and_change","another one"]
[grep]
files = ["somegrepsearch", "find tabs", "something else"]
[glyph]
files = []
[objects]
files = []
With the do_text
, do_object
, do_grep
and do_glyph
you can define if the script should do the corresponding find and replace. Set them to true
or false
.
In the [text]
,[grep]
,[glyph]
and [objects]
areas you can define the filenames that should be processed. Make sure the filenames are written right. If there is a file mentioned that does not exist the script will throw an error. It will try to process all the .xml files it can find.
!IMPORTANT! you MUST remove the .xml from the filename in the list as shown above.
The Script is here --> https://raw.github.com/...find-and-replace.jsx
The basic .toml file here --> https://raw.github.com/...ind-and-replace.toml
The Readme here --> https://github.com/...lob/master/README.md
And the whole package here --> https://github.com/...e/archive/master.zip
Copy link to clipboard
Copied
Good morning,
Excellent script, works like a charm ! Great job.
I was wondering if I could use this script for all currently open documents, instead of only the active one?
Right now, when I run the script, it only does the job on the currently active document. The other documents that are also open in InDesign, are not being edited. Thing is, I would like to use this for 300+ buttons every 2 weeks. Those buttons are made in seperate InDesign files. To click the script on every document is not an option, then I could just run the actual queries instead.
Would be great if this is possible, to apply this script with one click on all open documents.
Can you help me in the right direction? Thanks !
Greets,
Mirna
Copy link to clipboard
Copied
Good morning Mirna,
cool you dig this. I updated the script so it can work on all open documents. In the .toml file is a new "must have setting" called
do_all_docs = true
Set it to true if you want to process all open documents.
Let me know if this works for you.
Cheers
:Fab
P.S. The download link in the description points to the new version.
Copy link to clipboard
Copied
Thank you so much for the fast response.
Unfortunately I get an error.
There was an error while trying to process the "MPP_TITLE_SDF.xml"
Please make shure (sure) it exists and is at the right spot
Error: changeText
After clicking away this error for 8 times (I have 4 docs open, each doc has to execute 2 queries) only the active document is changed, the others aren't edited at all.
Tried both text and grep, they gave me the same errors on "changeText" and "changeGrep". In the .toml file ".xml" has been removed.
Thank you for your time, I really appreciate it.
Greets,
Mirna
EDIT: I changed "true" to "false" on the do_all_docs and I get no error. So it's only when this setting is set to "true".
Copy link to clipboard
Copied
Hi Mirna,
thats strange. This error should only occur when the .xml files are not at the right place or do not exist. The line where this error can happen is already within the doc processing. So it has nothing to do with the new loop that goes through all the docs.
Please double check again if your find change queries are at the right spot and the names match.
I tried it on my setup with 3 docs with text and grep searches and it works. Download the script again. I added some more debugging "try catch" with some alerts. If the error still happens please give me the error messages.
Cheers
:Fab
P.S. fixed the typo thanks
Edit:
It would be easier for me if we do the debugging on github. Here is the issue tracker for the script https://github.com/fabiantheblind/batch-find-and-replace/issues
Edit: sry for the Miranda. Don't know where this came from
Copy link to clipboard
Copied
Hi Fab,
Thank you so much for the help. Installed a fresh version of the script, and now it works except for one issue. But the errors are gone!
I added the issue on github Hope I did it properly, i'm not too femiliar with github.
Much appreciated.
Greets,
Mirna
Copy link to clipboard
Copied
Hey Mirna,
thats great that it works. Unfortunatly there is no issue on github.
And I realy want to know what the issue is
Copy link to clipboard
Copied
That's weird, I added it an hour ago. I only see it when I'm logged in.
When I go to your script page, I click "issues" and I see it in the list.
it's called
https://github.com/fabiantheblind/batch-find-and-replace/issues/1
Copy link to clipboard
Copied
Yeah thats strange. I get an 404 when I click on the link you provided. Did you get a account confirmation email or something like this? Maybe github wants to check if your not a robot.
Copy link to clipboard
Copied
Maybe you need to varify your account. Have a look here https://help.github.com/articles/setting-up-email-verification
Copy link to clipboard
Copied
@mirnad86 ā Hm. I cannot see any issues at:
https://github.com/fabiantheblind/batch-find-and-replace/issues
I also get a 404 with your linksā¦
Uwe
Copy link to clipboard
Copied
I had to verify my email, thanks Fab for the link. Didn't got an email for that (not even in spam). Done that, and filed an issue again.
Do I need a paid plan to file issues?
Copy link to clipboard
Copied
No. You don't need an paid account for that.
Now it gets even stranger. I can see your issues (the first and the secound) in my github timeline but when I click on the links I still get the 404.
Also I get a 404 when I try to see your accountā¦
Copy link to clipboard
Copied
I wrote to the github support. Maybe they can tell us what the problem is.
Copy link to clipboard
Copied
The github support fixed it on the fly. Now it works. Man - they are fast.
I will have a look into it.
Copy link to clipboard
Copied
That's so weird, but glad to see github could help you out ! Indeed super fast !
Glad to hear you can now view it. Have a great weekend !
Greets,
Mirna
Copy link to clipboard
Copied
Hi Mirna,
I updated the script again. Give it a try and tell me if it fixes your problem.
Cheers
:Fab
P.S. I had a good weekend I hope you too.
P.P.S. Are you getting the messages from the issue tracker on github?
Copy link to clipboard
Copied
Hi Fab,
Sorry I didn't got to this earlier, I got all messages but didn't had the time (nor the files) this weekend to test it out.
My weekend was ok, i'm glad to hear you had a great weekend too
Greets,
Mirna
Copy link to clipboard
Copied
Great script, it worked perfectly with grep, text, glyph, not only worked with OBJECTS, because I do the same operation and does not work. Can you give me a hand? Thank you.
In arquivo.toml is thus:
# These are the basic settings
# The MUST be there
do_text = true
do_grep = false
do_glyph = false
do_object = true
do_all_docs = false
# Now the file names
# They have to be in one line
# TomL the specs say you can break lines in arrays
# But does not allow the toml.js que momento
[text]
files = ["_OVER_BLACK_TXT", "_OVER_CORPROF_TXT"]
[grep]
files = []
[glyph]
files = []
[object]
files = ["_OVER_BLACK_FILL", "_OVER_BLACK_STRK"]
This is the image of the Scripts Panel folder:
Copy link to clipboard
Copied
It was not working because the. Jsx on line 1289, was missing the character "s" in the syntax. Instead of app.findObjectPreferece is to be app.findObjectPreferences, was missing the "s" in the word Preferences. I hope I have contributed to other users. Greetings!
Copy link to clipboard
Copied
Hi Turtles,
thanks for the hint. I did not receive a notification for your reply. Sorry for the delay I will fix this right away.
Cheers
Fabian
Copy link to clipboard
Copied
fixed. it. Latest version is online here
Copy link to clipboard
Copied
Hi! After almost a decade this is still a very usable script, but I just discovered a terrible error that it can produce if not used carefully:
If you execute a saved Find/Change that calls for a replacement Character Style that does not exist in an InDesign document, the found text will simply be deleted. There is neither message about error nor the batch stops.