Skip to main content
Inspiring
October 26, 2022
Answered

[Old topic] Find Text by Formatting and convert to outline

  • October 26, 2022
  • 3 replies
  • 1138 views

Hi everyone!

I've found this script on an old topic and it's exactly what I need, however when I run it on JavaScript I get this message "found.createOutlines is not a function". Can anyone have a look on it for me?

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.createOutlines();


    }


app.findTextPreferences = null;


Thanks in advance,
Rogerio

This topic has been closed for replies.
Correct answer Rogerio5C09

Hi Mike,

Thanks for that! 🙂

I also need a version that keeps the editable formatted text in the document (right after the outline one). I created a hidden condition for the same. So, the script find the text by formatting (as usual), 1) duplicate each (right after in the same line); 2) outline the original formatted text; 3) find all the duplications by formatting and apply hidden condition 'Editable Text', so that only the outline text is visible in the document. Would that be possible?

Thanks,
Rogerio


Here's the link to the script in case anyone needs it:
https://community.adobe.com/t5/indesign-discussions/convert-outlines-back-into-live-text/m-p/13388168#M505122 

Regards,
Rogerio



3 replies

Community Expert
October 29, 2022

Just a note:

The ExtendScript code you copied over was damaged when the thread was moved from the old InDesign Scripting Forum to this new one in October 2019. Iterator [i] was dropped in the code. A typical error by the merging process of the forum threads back then. Thankfully Mike @Mike Bro already posted the repaired code over there:

https://community.adobe.com/t5/indesign-discussions/find-text-by-formatting-and-convert-to-outline/m-p/13298519#M499187

 

Thanks,
Uwe Laubender
( Adobe Community Expert )

Legend
October 26, 2022

Hello @Rogerio5C09,

 

Give this a try....

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

Inspiring
October 26, 2022

It worked! Thank you so much Mike! 🙂

Inspiring
October 28, 2022

Hi Mike,

I would like to include an alert in case there isn't a Character Style called 'Pink Text" in the document. I have tried to do it myself, but no luck 😞  Could you please have a look?

var myCharacterStyleName = "'Pink Text'"; 

if (to be completed) {
	alert("Create a Character Style called " + myCharacterStyleName, "Outline Pink Text" , true);
    }

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;


Thanks in advance,
Rogerio

Willi Adelberger
Community Expert
Community Expert
October 26, 2022

Never outline Text in InDesign.