Skip to main content
K.Daube
Community Expert
Community Expert
February 25, 2022
Answered

Checking out CallClient("Structure Generator", ...

  • February 25, 2022
  • 1 reply
  • 114 views

Dear Friends and Gurus,

I want to understand this business with the called clients. Success with ApplyMasterPages and BookErrorLog, but no success with the Structure Generator. The following script runs without error, but where is the generated table document?

/* E:\_DDDprojects\FM-JsxLib\FMjsxLib\Functions\Demos\GenerateConversionTable.jsx 
              Test/Demo for Generate Conversion Table
History       2022-02-15
*/ ; // ========================================================================

//@target framemaker
var KLD_Z = KLD_Z || {};                          // global script object

//@include ..\Message.jsx 

KLD_Z.GenerateConversionTable = function (oDoc) { // ==========================
/*            Generate a conversion table to convert document to structed document
Arguments     oDoc            Document for which to generate the table
Return        false in case of error, else true;
Comment       See also function UpdateConversionTable
Reference     FDK Programmer's Reference "F_ApiCallClient() calls to generate a conversion table"
History       2022-02-25
*/
var docID, msg01, msg02, ret;

  docID = oDoc.id;
  msg01 = "First call to Client «Structure Generator» for document ID %01 failed with return code %02. I have no clue what this means.";
  msg02 = "Second call to Client «Structure Generator» for document ID %01 failed with return code %02. I have no clue what this means.";

  ret = CallClient("Structure Generator", "SourceDocId " + docID);
  if (ret != 0) {
    KLD_Z.Message ("E", msg01, "GenerateConversionTable", [docID, ret]);
    return false;
  }
  ret = CallClient("Structure Generator", "GenerateTable");
  if (ret != 0) {
    KLD_Z.Message ("E", msg02, "GenerateConversionTable", [docID, ret]);
    return false;
  }
  return true;
} //--- end GenerateConversionTable --------------------------------------------

KLD_Z.main = function () { // <><><><><><><><><><><><><><><><><><><><><><><><><>
var oDoc, oFlow, oTFrm, oAFrm;

  oDoc=app.ActiveDoc;
$.bp(true);
  KLD_Z.GenerateConversionTable (oDoc);
} //--- end main ---------------------------------------------------------------

KLD_Z.main ();

 Towards the end of t he script something happens with the source document (it seems that the cursor moves through the page), but no additional document is opened.

→ Any ideas?

    This topic has been closed for replies.
    Correct answer K.Daube

    It's that simple, but not written anywhere:

    FM must be in Structured Mode for this client to work!

    Since the API client is always there in maker.ini it's not that obvious...

    1 reply

    K.Daube
    Community Expert
    K.DaubeCommunity ExpertAuthorCorrect answer
    Community Expert
    February 26, 2022

    It's that simple, but not written anywhere:

    FM must be in Structured Mode for this client to work!

    Since the API client is always there in maker.ini it's not that obvious...