Skip to main content
Inspiring
May 17, 2023
Answered

Extecndscript ShowConditionalText as per condition ...

  • May 17, 2023
  • 1 reply
  • 1000 views

Okay - I have a script that was deleting paragraphs based on markers, it wasn't working with hidden conditional formatting so I added:

doc.ShowAll = true;

at the beginning of the script and 

doc.ShowAll = false;

at the end, which works.

I have a new scirpt which inserts a file as a copy at the beginning of the active document. When it does this, it tends to show all of the conditional text in the active document.

I added doc.ShowAll = false; at the end of the script, but it doesn't seem to work (occasionally it does, but usually it does not.

I tried doc.ShowAll = 0; but that didn't work either.

I saw on page 694 (Electronic) of the Framemaker scripting manual that there is supposed to be a book property so I tried:

doc.ApplyConditionalSettings(Constants.FV_ShowAsPerConditions);

But it said that wasn't a function.

I realize it's pretty easy to click the button manually, but still ...

This topic has been closed for replies.
Correct answer Klaus Göbel

It's just a little typo:

change

if (CondFmt.CondFmtIsShown = 0){

 to

if (CondFmt.CondFmtIsShown == 0){

 

1 reply

frameexpert
Community Expert
Community Expert
May 18, 2023

If you use

doc.ShowAll = 0;

that will only hide condition formats that have this property set:

condFmt.CondFmtIsShown = 0;

 

For example, let's say you have two conditions in your document and both are currently showing because they are in the Show list:

 

Changing the doc.ShowAll setting will not change the appearance of the document because both conditions are set to be shown. The ShowAll property only has an effect when one or more of the conditions is hidden.

Inspiring
May 18, 2023

Rick - I basically understand that, but it is not working.

For Example - I have Conditon B hidden.

I run doc.ShowAll = true, and I see both Condition A and Condition B in the document.
I run doc.ShowAll = false; and I only see Condition A.
That works correctly in ONE of my scripts.
In the script in question, I have Condition B hidden.

I import a .fm file using the source document properties by copy.

Condition A and Condition B as shown in the document, although Condition B is hidden on the show/hide conditional text screen. Doc.ShowAll = false, doesn't seem to hide the Condition B info, although I think it should...
Maybe it has to do with what is shown/hidden on the imported file, but I can't change that - unless I somehow note what was hidden initially and reset it afterwards - but I'm not that advanced in ESTK.

 

frameexpert
Community Expert
Community Expert
May 18, 2023

How are you importing the file? After you import it, is the Condition B format still correctly applied to the text from the imported file? If you want, you can email me the file and I will take a look at it. Or we can do a quick zoom meeting so I can see it. Contact me offlist: rick at frameexpert dot com