1 Reply Latest reply on Feb 20, 2013 5:57 AM by frameexpert

    How to verify if a document is updated?

    wokoman1234 Level 1

      Hi, How would I select a page based on it's id ?

       

      To set the scene ; I'm running a couple of scripts to allow me to update a conversion table on the fly. This all works fine, but I'd like to check if my original conversion table is updated or not using extendscript. The result could then trigger next steps, as for instance structuring the book if the conversion table didn't change, or give a warning message in case it was changed.

       

      This is what I have :

       

      // UpdateConvTable() is called from within another function, and is used for any document in a selected book

      // convTableId is global variable storing the docID of my conversion table

       

      function UpdateConvTable(doc,name){

       

      var docId = doc.id;

      CallClient("Structure Generator", "SourceDocId " + docId);

      CallClient("Structure Generator", "UpdateTable " + convTableId);

       

      // missing magic here

       

      var params = GetSaveDefaultParams();

      var returnParamsp =new PropVals();

      var i = GetPropIndex(params, Constants.FS_FileType);

      params[i].propVal.ival =Constants.FV_SaveFmtBinary;

       

      doc.Save(name, params, returnParamsp)

      return

      }

       

      The 'missing magic' part I want to replace with a quick check to see if the conversion table is actually updated or not. I assume I can do this with the DocIsModified statement, but I can only find examples using the active document (if(app.ActiveDoc.DocIsModified) { some code here} ) , but I'm stuck on getting it working with a document that's not active (but on screen). It works fine selecting the doc manually, it returns true if modified and false if not, but I want to do this on a doc based on it's id.

       

      So something like if(convTableId.DocIsModified) {some code here} , but that would have been to easy :-)

       

      Anybody that can help me with the correct syntax ?