8 Replies Latest reply on Feb 17, 2012 1:58 PM by OliverJohn

    Structure documents method

    4everJang Level 3

      Hello all,

       

      I have almost finished my fully automated conversion project for a customer who has a lot of books, each containing lots of chapters, which must be converted to structured FM without losing anything of the current formatting. Quite a task, but it is looking good. I have a preprocessing script and a postprocessing script but the step in the middle is missing. I need to call the StructureTools > Utilities > Structure Documents command and pass it the name of the conversion table, the name of the origin directory and the name of the destination directory. This is just about the only step the customer has to do manually. If there is a way to incorporate this in the script that would be beautiful, but I cannot find the command anywhere. Am I looking for something impossible ?

       

      Ciao

       

      Jang

        • 1. Re: Structure documents method
          OliverJohn

          Hi, Jang--

           

          The command you're looking for is the global method CallClient().

           

          A number of utilities, including the structure generator, are implemented via FDK clients. The API info you'll need can be found in Appendix A of the FDK Programmer's reference.

          • 2. Re: Structure documents method
            4everJang Level 3

            Hi Oliver,

             

            Thanks for this pointer. It allows me to solve another couple of problems with the conversion - such as a coverpage that requires another root element and therefore another conversion table. I found the info in the FDK reference and it seems pretty clear, so I do not expect any problems with it.

             

            Ciao

             

            Jang

            • 3. Re: Structure documents method
              4everJang Level 3

              As I said, I did not expect any problems following the instructions in the FDK...

               

              Except that it does not seem to work in the same way from ExtendScript. I am using the following piece of code and there is NO result whatsoever. In the code, the doc is the active document and the convtable is a handle to the opened conversion table - that part works fine.

               

              if ( convtable.ObjectValid() && doc.ObjectValid() ) {

                myarg = "InputDocId " + doc.id;

                CallClient ( "Structure Generator", myarg );

                myarg = "RuleDocId " + convtable.id;

                CallClient ( "Structure Generator", myarg );

                myarg = "GenerateDoc";

                CallClient ( "Structure Generator", myarg );

              }

               

              The "nice" thing is that a CallClient to the Structure Generator always returns FE_Success, no matter what. I tried passing the objects first, but that did not work, so I found the 'id" in the Data Browser and figured that would be the ID that the FDK is talking about. Maybe not. There is no pointer in the ExtendScript reference to finding out the ID of an object, or I have not been looking in the right places...

               

              Jang

              • 4. Re: Structure documents method
                OliverJohn Level 2

                You're correct that the .id property is the referenced ObjectID value.

                 

                The one thing that jumps out at me is that the fdkref I'm looking at lists five calls, not three.

                 

                F_ApiCallClient("Structure Generator", "InputDocId objectID");

                F_ApiCallClient("Structure Generator", "RuleDocId objectID");

                F_ApiCallClient("Structure Generator", "OutputDocName pathname");

                F_ApiCallClient("Structure Generator", "LogName pathname");

                F_ApiCallClient("Structure Generator", "GenerateDoc");

                • 5. Re: Structure documents method
                  4everJang Level 3

                  That I know. The two calls I left out are irrelevant for the process. They omit saving the converted output (step 3) and suppress the generation of a Log file (step 4).

                  • 6. Re: Structure documents method
                    OliverJohn Level 2

                    The output file isn't relevent?

                    • 7. Re: Structure documents method
                      4everJang Level 3

                      If you do not specify an outputfile it remains open as UntitledXX.fm (with digits for the XX). It is in the specs.

                      • 8. Re: Structure documents method
                        OliverJohn Level 2

                        Ah. You're right. I had misread that sentence as refering to the path as optional, not the call.

                         

                        The only other thing I can think of (which you've probably already tried) would be to assume Adobe applied the ES object-abstraction layer to this client as well, and try passing the Doc objects directly, rather than by .id. Other than that, I can only hope someone from inside Adobe weighs in.