Copy link to clipboard
Copied
I have a text of about 300 pages in InDesign. Some words, which should be in italics, have one or 2 letters in regular. Is there a way to automatically find all words where one or two letters are not in italics and change them to italics like the remaining letters in the word?
Hello @michalart see if this helps you: https://creativepro.com/how-to-find-and-fix-partially-italic-words-with-grep/
Copy link to clipboard
Copied
Hi @michalart
Can you show a screenshot of what you need before and after? It would be easiest for anyone reading here.
Copy link to clipboard
Copied
Either some fancy GREP or script.
Copy link to clipboard
Copied
Hello @michalart see if this helps you: https://creativepro.com/how-to-find-and-fix-partially-italic-words-with-grep/
Copy link to clipboard
Copied
Hello @michalart see if this helps you: https://creativepro.com/how-to-find-and-fix-partially-italic-words-with-grep/
By @Brito Haroldo
Thanks for this link - it just gave me an idea how to improve my tool even more.
Copy link to clipboard
Copied
Hello @Brito Haroldo thank you, the link you provided solves exactly what I needed to solve, it is perfect and simple 🙂 Thanks a lot
Copy link to clipboard
Copied
This does the job:
var c = 0;
var tfs = app.activeDocument.textFrames;
for(i=0; i<tfs.length; i++) {
for(j=0; j<tfs[i].words.length; j++) {
var italicChars = 0;
for(k=0; k<tfs[i].words[j].characters.length; k++) {
if(tfs[i].words[j].characters[k].fontStyle == "Italic") {
italicChars++;
}
if( (k == tfs[i].words[j].characters.length-1) && (tfs[i].words[j].characters.length > italicChars) && (italicChars != 0) ) {
tfs[i].words[j].fontStyle = "Italic";
c++;
}
}
}
}
alert(c + " words replaced in " + tfs.length + " text frames.");
Before:
After:
Copy link to clipboard
Copied
Don't want to sound patronising, just trying to be helpful:
Copy link to clipboard
Copied
hello @Robert at ID-Tasker , firstly congratulations on your tool it really looks very robust. For now I'll need to wait for the Mac version.
Now about your comment it seems perfect! It would be incredible, and I believe the community would appreciate it, if you had some time to improve your suggestions on the code suggested, which is functional within what is proposed, by colleague @GNDGN . 😃
In any case, your comments are valuable especially for those, like me, who are struggling to learn scripts and being able to relate action x result and strategy is undoubtedly an important layer in learning.
Copy link to clipboard
Copied
Thanks, unfortunately, for various reasons, mainly because I don't have a Mac and I don't think it would be possible to create such advanced UI on a Mac - I mean with such advanced functionality - I don't plan on creating version for Mac ... but you can always use it in your network, you would need a dedicated PC and WatchedFolders Mode.
I'm not a JS guy so if I can, I may try to share some JS code but rather prefer to give an "algorithm", just in case I'm mistaken.
Sometimes, my replies may sound harsh, as English isn't my main language, I might be too direct and not polite enough.
Copy link to clipboard
Copied
Select in Word 1 formatted word or letter, in the style menu is command to select all with this formatting. Now you can apply or create a character style.
Copy link to clipboard
Copied
hello @Willi Adelberger . I love solutions that scale from something just within reach to more sophisticated solutions.
I tested here in Word for Mac I managed to get the italics, not italics but mixed: italics/non-italics, at least in my Word, it didn't work: it selected all the text without understanding my intention of just "mixed".
Maybe it works on Windows, or I'm definitely doing something wrong.
Copy link to clipboard
Copied
No, on Windows it won't work either, it will only select letters with this particular formatting - not whole words:
Copy link to clipboard
Copied
… Hmm! Sometimes, a partial italic can justify the entire word(s) are italicized, sometimes not! 😉
So, "Do" or "Skip"!
Just For Fun! …
(^/) The Jedi
[paid script]