Skip to main content
Inspiring
October 12, 2023
Answered

ESTK Script line to refresh Show Hide Conditional Text Pane needed!

  • October 12, 2023
  • 1 reply
  • 447 views

FrameMaker 15.

 

I have a simple script to prompt and update whether conditional text formats are shown. It works fine. However, FM does not "Visually" update the Show/Hide Conditional text pane, until I click to a different pane and back to it.

 

This causes the following issue:

Format 1 is initially hidden. User runs script and clicks to show Format 1. Scripts shows Format 1 and updates document, however, Format 1 appears hidden in the Show/Hide Condiitonal text pane, if that was active when the script was run. User does not click another tab in FM and hides Format 2 and clicks Apply. Format 1 is now hidden also b/c it was visually under Hide, so apply hides it as well.

 

I need a line that I can add to my script so that the Show/Hide Conditional Text pane displays properly. Alternately, the script could just manually select some other pane or close the Show/Hide Condiitonal text pane, which would mean that when the user opened it, it would be refreshed and show the valid information.

 

This is an example of the current script:

 

        var doc = app.ActiveDoc;       
        SetConditionalText (doc)

function SetConditionalText(doc){
        var CondFmt = doc.GetNamedObject (Constants.FO_CondFmt, "Format 1");
        if (CondFmt.ObjectValid()){
            if(!Alert("Should Format 1 be shown?", (5))){ // (5) - is Default No - Page 1017 FM Scripting. Alert (Cap) is ESTK, alert is JS.
                //alert ('Format 1');
                CondFmt.CondFmtIsShown = 1; // 1 for show, 0 for hide.
            }
            else{ 
                //    alert('Not  Format 1');
                CondFmt.CondFmtIsShown = 0; // 1 for show, 0 for hide.
            }
        } // Format 1 not valid.
} // End SetConditional Text

 

Worst case, I can add a final Alert pop-up to say "Click away from the Show/Hide Conditional Text Pane before continuing.", but that seems like a very unprofessional solution.

 

Thank you in advance!

This topic has been closed for replies.
Correct answer Marshall_Brooks

Correction - KBD_CLOSE_COND by itself doesn't seem to do anything. It does NOT remove focus from Show/Hide Conditional text. (It might remove focus from Conditional Tags pane).

FOCUS_INPUT_COND probably sets focus on the Conditional Tags pane - which is not desired, but serves the purpose as the user then has to click back to Show/Hide Conditional Text, which will then be updated.

 

More research pending.


 

 

Fcodes ([FCodes.FOCUS_INPUT_COND, Fcodes.KBD_CONDVISIBILITY]);

 

 

This SHOULD work, but it doesn't.

 

It should put the focus on Conditional Tags and then re-open Show/Hide Conditional Text - but KBD_CONDVISIBILITY doesn't seem to be working - unless I typo'd it somehow.

 

UPDATE - it does work. I had a reference document that showed the code as kbdCondVisibility without the _. That doesn't work. The code above does.

Thanks again to FrameExpert for the solution!!!

1 reply

frameexpert
Community Expert
Community Expert
October 12, 2023
Fcodes ([FCodes.KBD_CLOSE_COND, FCodes.FOCUS_INPUT_COND]);

I haven't tested this, but you can try triggering some FCodes to close and reopen the palette.

frameexpert
Community Expert
Community Expert
October 12, 2023

Here are some other possible FCodes that may be helpful: