1 Reply Latest reply on Feb 15, 2012 12:37 PM by OliverJohn

    Are there situations where you can NOT override the FA_errno's code?

    jaloren28 Level 2

      I have a script that does the following:

      1. creates an array
      2. calls a function that populates the array with a list of paragraphs in the FrameMaker document
      3. executes a while loop that then process this array. The while loops conditional is FA_errno==Constants.FE_Success.

       

      The function returns a FA_errno of -3, which is fine because I was using the ObjectValid method to iterate through the paragraphs so eventually the object will be invalid. My problem is that I cannot override the error code after I exit that funciton. The FA_errno stays set to negative 3. Am I missing something or are there situations that forbid you from overriding the error code?

       

      The relevant code is as follows:

       

      var vDoc=app.ActiveDoc;

      var vFlowArray=new Array();

      var vFirstPgf=vDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

      getPgfList (vFirstPgf, vFlowArray);

       

      //due to getPgfList function, the FA_errno is -3 so i am going to overwrite the code

      FA_errno=Constants.FE_Success

       

      while (FA_errno==Constants.FE_Success)

      //a bunch of stuff occurs in the while condition but i am not showing it because this never evaluates to true

       

       

      function getPgfList (pPgf,pArray)

      {

          while (pPgf.ObjectValid())

          {

       

              pArray.push (pPgf);

              pPgf=pPgf.NextPgfInFlow;

              }

               }

        • 1. Re: Are there situations where you can NOT override the FA_errno's code?
          OliverJohn Level 2

          I've reproduced this bug on my own machine. In fact, in my limited testing, I did not find any situations where I could explicitly initialize FA_errno. Hopefully this gets fixed soon.

           

          A workaround, admittedly not the most elegant, could be to call a method with no side-effects that will reset the code for you, e.g.,

           

               function initFA_errno()

               {

                   app.GetNamedMenu("!MakerMainMenu"); //If this fails, you've got bigger problems

                   return;

                   }

          1 person found this helpful