Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: Deleteing assoiated text form conditional text dialiog

$
0
0

Welcome to InDesign Scripting!

 

Vincent-Sweden wrote:

How can I write the code to remove the text/object for each dimmed conditon.?

 

Dimmed == not visible? Then you can use the following code. Trevor's Replace With Nothing trick does not work when a conditional text is invisible, so this script scans your list for Not Visible conditions, makes them visible, replaces them with no text, and then removes the condition itself.

 

I only tested it on a small text document -- please make sure you test on a copy of yours!

 

#target indesign
var myDoc = app.activeDocument;
app.findGrepPreferences = app.changeGrepPreferences = null;// Change "Condition 1" to name of your condition
myConditionList = app.activeDocument.conditions.everyItem().getElements(); for (i=myConditionList.length-1; i>=0; i--){    if (myConditionList[i].visible == false)    {        myConditionList[i].visible = true;        app.findGrepPreferences.appliedConditions = [myConditionList[i].name] ;        app.findGrepPreferences.findWhat = ".+";        myDoc.changeGrep();        app.activeDocument.conditions.item(myConditionList[i].name).remove();    }}

 

(Edit) Hi Vamitul, hi Trevor!


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>