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!