Copy link to clipboard
Copied
Hi guys,
I need an "Action like" functionality, and I want to know how to do it.
For DTP purposes, I need to decrease the text size in a document consistently multiple times - 9 to 8, 10 to 9, 11 to 10 etc. This is an easy find/replace. The trick is that I need to do this in hundreds of documents, but not simultaneously, so the "All documents" option is not applicable.
Is there some kind of "Action consequence" that I can save and run automatically, instead of doing this by hand every time?
Thanks ![]()
An alert!
Remeber: if you run the code more than one time in the same doc, it'll resize the texts that has already been resized from 11 to 10 and from 10 to 9. And resizes them again to 9 and 8 respectively. The code will work until no texts in 9, 10 or 11 points are found.
Copy link to clipboard
Copied
Yes. Of course.
The rule is always the same?
Every text with 9pt decrease to 8pt.
Every text with 10pt decrease to 9pt.
Every text with 11pt decrease to 10pt.
Is it?
These sizes occurs in the same document?
It depends on the font type or not?
>
Copy link to clipboard
Copied
Yes, the rule is always the same, 9->8, 10->9 etc. I need this done in one or more documents at a time. It does not depend on the font, just pure text size change.
Can you explain how to do it? Thanks
Copy link to clipboard
Copied
Making a javascript.
​Depends on your needs, it could be done using:
for (var i=app.activeDocument.stories.length-1; i>=0; i--) {
for (var j=app.activeDocument.stories.paragraphs.length-1; j>=0;
j--) {
app.activeDocument.stories.paragraphs
app.activeDocument.stories.paragraphs
}
}​
In this code we'll find all stories in the current document and all
paragraphs in each story.
For each of those paragraphs, we'll decrease its pointSize by one point.
====================
We can be more specific, finding only texts in 9pt, 10pt and 11pt.
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.pointSize = 9;
app.changeGrepPreferences.pointSize = 8;
app.activeDocument.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
Keep in mind that the codes only deal with pointSize.
In my tests I'm using automatic leading size. If you have a different
leading size, it'll need to be treated too.
Copy link to clipboard
Copied
It seems this will do the job. You're great!
The one problem is that I cannot handle this code making it JS.
Can you please explain how to create .jsx file from this code, more specifically from the second part where I can "appFind" a specific size and "appChange" to to another specific size.
I'm sorry for insisting, but I work with Indd only, and I cannot be sure to handle creating the correct jsx file from this code.
Thanks again ![]()
Copy link to clipboard
Copied
Just open any text editor, copy and paste the code you want and save the
file as jsx.
You can repeat the entire code to find/change different text sizes.
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.pointSize = 9;
app.changeGrepPreferences.pointSize = 8;
app.activeDocument.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.pointSize = 10;
app.changeGrepPreferences.pointSize = 9;
app.activeDocument.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.pointSize = 11;
app.changeGrepPreferences.pointSize = 10;
app.activeDocument.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
Copy link to clipboard
Copied
I saved this code as .jsx file:
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.pointSize = 9;
app.changeGrepPreferences.pointSize = 8;
app.activeDocument.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.pointSize = 10;
app.changeGrepPreferences.pointSize = 9;
app.activeDocument.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.pointSize = 11;
app.changeGrepPreferences.pointSize = 10;
app.activeDocument.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
When I load the script and try to run it, an error occurs:
Syntax Error
Line 1
What I'm doing wrong?
Copy link to clipboard
Copied
I don't know. I copied the code you sent, saved as jsx file, put it into
the scripts panel folder and it runs fine.
Copy link to clipboard
Copied
Can you please send me your jsx file at vakarelski@gmail.com?
I really like your responsiveness and dedication, I would like to have further business relations with you!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
An alert!
Remeber: if you run the code more than one time in the same doc, it'll resize the texts that has already been resized from 11 to 10 and from 10 to 9. And resizes them again to 9 and 8 respectively. The code will work until no texts in 9, 10 or 11 points are found.
Copy link to clipboard
Copied
The trick is that I need to do this in hundreds of documents
You can run your script from my Batch processor. BTW, soon I am going to post a new -- a more advanced -- version.
— Kas
Find more inspiration, events, and resources on the new Adobe Community
Explore Now