4 Replies Latest reply on Jan 12, 2012 9:02 AM by JackFreudenheim

    app.doc not working anymore - stuck, please help

    JackFreudenheim Level 1

      I'm fairly new to javascript development inside Acrobat. I had a set of working folder-level scripts that created buttons. Using Acrobuttons, I set them up using this type of pattern:


      var oButton =

      {cName: "testButton",

      cExec: DoCmdTest,

      cEnable: "event.rc = (checkValid())",

      cMarked: "event.rc = false",

      cTooltext: "try again!",

      nPos: -1,

      cLabel: "Try again"};



      where the checkValid() function was defined above, something like this:


      checkMyValid = app.trustedFunction(function(){

                if (app.doc == null) {

                          console.println('it still thinks it is null');

                                    return false;


        // other checks here to see if the button should be enabled...

        // in which case they return true;


        // otherwise:

         return false;




      This was all working fine, until yesterday. Suddenly, app.doc is null every time. And if I use app.activeDocs[0], same result.


      Yet when I use the console with a document open, app.doc and app.activeDocuments[0] both return my document.


      Has anyone experienced this?