FM-14: Setting View options incorrect

Advocate ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Dear all,

Having discovered that in FM-14 the multi-code commands do not work correctly, I thought to bypass this flaw by a script. However, also this is not working correctly. With the change that the view properties are no more document settings, but session settings, things might have been mixed up. oDoc.ViewOption (e.g. oDoc.ViewBorders) seem to be read-only now (until FM-13 they were read/write). Hence I need to check and then toggle:

// test ETBSubstituteLostCommands.jsx
#target framemaker

// With View > Options set Grid lines, Borders, Text Symbols, Rulers and Graphics to ON
var   oDoc = app.ActiveDoc;
Console ("Initial setup:\t"   + oDoc.ViewBorders + " " + oDoc.ViewTextSymbols + " "
                              + oDoc.ViewRulers  + " " + oDoc.ViewGrid + " "  + oDoc.ViewNoGraphics);

SetAllOff ();
Console ("SetAllOff:\t\t" + oDoc.ViewBorders + " " + oDoc.ViewTextSymbols + " "
                              + oDoc.ViewRulers  + " " + oDoc.ViewGrid + " "  + oDoc.ViewNoGraphics);
// result Initial setup:    1 1 1 1 0
//        SetAllOff:        1 1 0 0 1  Borders and text symbols not cleared!

function SetAllOff () {
var oDoc,
    cmd1 = app.GetNamedCommand ("ViewBorders"),       // these are all toggles
    cmd2 = app.GetNamedCommand ("ViewTextSymbols"),
    cmd3 = app.GetNamedCommand ("ViewRulers"),
    cmd4 = app.GetNamedCommand ("ViewGridLines"),
    cmd5 = app.GetNamedCommand ("ToggleGraphicsDisplay");

  if (!app.ActiveDoc.ObjectValid()) {
    alert (localize (gsMsgNoDoc));
    return;
  }
  oDoc = app.ActiveDoc;

  if (Doc.ViewBorders == 1) {
    Fcodes ([cmd1.Fcode]);                        // => set Borders      OFF
  }   
  if (Doc.ViewTextSymbols == 1) {
    Fcodes ([cmd2.Fcode]);                        // => set Textsymbols  OFF
  }
  if (oDoc.ViewRulers == 1) {
    Fcodes ([cmd3.Fcode]);                        // => set Rulers       OFF
  }
  if (oDoc.ViewGrid == 1) {
    Fcodes ([cmd4.Fcode]);                        // => set Gridlines    OFF
  }
  if (oDoc.ViewNoGraphics == 0) {
    Fcodes ([cmd5.Fcode]);                        // => set Graphics     OFF
  }
  return;
} // --- end SetAllOff

I have reported this as bug FRMAKER-2807

If this is not a bug, but a programming error of mine - please give me a hint!

TOPICS
Scripting

Views

146

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

Oh heaven, again my standard error!

Lines 29 to 34 must read

  if (oDoc.ViewBorders == 1) { 
    Fcodes ([cmd1.Fcode]);                        // => set Borders      OFF  
  }     
  if (oDoc.ViewTextSymbols == 1) { 
    Fcodes ([cmd2.Fcode]);                        // => set Textsymbols  OFF 
  }

Unfortunately I can not remove the whole post ...

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines