Skip to main content
Inspiring
June 7, 2020
Answered

Replace all combinations of conditions with "Unconditional"

  • June 7, 2020
  • 1 reply
  • 734 views

Can any one tell me how to iterate through all combinations of conditions and replace with "Unconditional"?

 

Let's say for example, we have three conditions: A, B, and C. I would need the following combinations to be reaplaced:

 

A -> Unconditional

B -> Unconditional

C -> Unconditional

A&B -> Unconditional

A&C -> Unconditional

B&C -> Unconditional

A&B&C -> Unconditional

 

This is just an example. A document may contain any number of conditionals (may be up to eight).

 

Thank you in advance.

Tak

This topic has been closed for replies.
Correct answer brian_p_dts

Assume you're talking about conditional text? 

 

 

app.activeDocument.textFrames.everyItem().texts.everyItem().appliedConditions = [];

 

If some is inside tables, you'll also need: 

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().texts.everyItem().appliedConditions = [];

 

 

 

 

1 reply

brian_p_dts
Community Expert
brian_p_dtsCommunity ExpertCorrect answer
Community Expert
June 7, 2020

Assume you're talking about conditional text? 

 

 

app.activeDocument.textFrames.everyItem().texts.everyItem().appliedConditions = [];

 

If some is inside tables, you'll also need: 

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().texts.everyItem().appliedConditions = [];

 

 

 

 

Tak OsatoAuthor
Inspiring
June 7, 2020

Thanks for the reply. Iterating through every text item, rather than finding and replacing, makes sense.