Copy link to clipboard
Copied
Hi! I need a script which find the text by formatting and convert to outline. If any one know who can make this script please provide.
Thanks
I need the script for specific formatting only for once. So I not need any fancy options or dialog boxes. I also made the character style for the formatting.
Try this.
var doc = app.activeDocument;
app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = "charstylename";
var found = doc.findText();
for(var i =0;i<found.length;i++)
{
found.createOutlines();
}
app.findTextPreferences = null;
Regards,
Chinna
Hello @Rogerio5C09,
Some of the script's formatting was lost when ported over from the old site.
I also posted the corrected code under your new post here:
var doc = app.activeDocument;
app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = "Pink Text";
var found = doc.findText();
for(var i =0;i<found.length;i++)
{
found[i].createOu
...
Copy link to clipboard
Copied
Try this.
var doc = app.activeDocument;
app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = "charstylename";
var found = doc.findText();
for(var i =0;i<found.length;i++)
{
found.createOutlines();
}
app.findTextPreferences = null;
Regards,
Chinna
Copy link to clipboard
Copied
It;s not finding the characterstyle kindly see the screenshot for error
Copy link to clipboard
Copied
Check spelling of the character style name in the indesign, it is a case sensitive so the character style should be Word.
Copy link to clipboard
Copied
I try this on new document there it is working well. But for this document its keep giving error. Here is the link of the file G.indd - Send Files Online - TempSend.com In this file I need to convert phonetic symbols into outlines. I also try on other styles but It didn't work.
Regards
Copy link to clipboard
Copied
I have only cs6 so send idml file not indd.
Copy link to clipboard
Copied
Please try this
Copy link to clipboard
Copied
The reason for not working is the characters style Word is in the gruop "Done".
I just modified the code. Try now.
var doc = app.activeDocument;
app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = doc.characterStyleGroups.item("Done").characterStyles.item("Word")
var found = doc.findText();
for(var i =0;i<found.length;i++)
{
found.createOutlines();
}
app.findTextPreferences = null;
Regards,
Chinna
Copy link to clipboard
Copied
what it works for you? For me it's not working. Surprisingly In my debugging i try on several other documents and I found that if the character style is alone in paragraph then it works good however the character style in paragraphs the it 'll give error.
Copy link to clipboard
Copied
It is working fine here, I tried with your document only. Try again.
If the character style is in group ("Done") then
app.findTextPreferences.appliedCharacterStyle = doc.characterStyleGroups.item("Done").characterStyles.item("Word")
else it should be
app.findTextPreferences.appliedCharacterStyle = doc.characterStyles.item("Word");
Copy link to clipboard
Copied
Thanks It works well. Yeah you was right it was the issue of the grouping.
Copy link to clipboard
Copied
Hi Chinna,
I know this is a very old topic, but this script is exactly what need! 🙂 Does it work with InDesign 2022 as well? I'm getting a "found.createOutlines is not a function" message when I try to run it on JavaScript.
Thanks in advance for checking.
Rogerio
Copy link to clipboard
Copied
Hello @Rogerio5C09,
Some of the script's formatting was lost when ported over from the old site.
I also posted the corrected code under your new post here:
var doc = app.activeDocument;
app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = "Pink Text";
var found = doc.findText();
for(var i =0;i<found.length;i++)
{
found[i].createOutlines();
}
app.findTextPreferences = null;
Regards,
Mike
Copy link to clipboard
Copied
Thanks again, Mike! 🙂