8 Replies Latest reply on Dec 2, 2009 2:16 AM by Dirk Becker 

    Strange interaction with XHTML For Digital Editions

    scriptworker Level 1

      Hi all,

       

      I have written a scripted plugin with menuItems for Indesign CS4.

      This scripted plugin is interacting in a strange way with XHTML

      For Digital Editions. In my plugin there is a menu item that exports

      Indesign content to XML. When using this function an error is

      generated sometimes:

       

      ---------------------------------

      error number 30476.
      The requested action cannot be processed because the object is no more existing.

       

      C:\Program Files\Adobe\Adobe Indesign CS4\Scripts\XHTML For Digital Editions\6

      Line:381

      ----------------------------------

       

      There is a startup script to load my plugin and it uses a targetengine.

      How can it be that my plugin is interacting with "XHTML For Digital Editions"?

       

      Suggestions to solve this problem are very welcome.

       

      Kind regards,

      Michel

        • 1. Re: Strange interaction with XHTML For Digital Editions
          Harbs. Level 6

          I assume you are using APID.

           

          What does your spln do?

           

          Harbs

          • 2. Re: Strange interaction with XHTML For Digital Editions
            scriptworker Level 1

            It's not using APID.

             

            The error message gives a line in the XHTML plugin as a fault,

            but I think it's a line in my own plugin.

             

            Don't know why it gives the XHTML plugin as the source.

             

            Michel

            • 3. Re: Strange interaction with XHTML For Digital Editions
              Harbs. Level 6

              Without knowing what you are doing, it's hard to guess why you are 

              getting that error.

               

              You are probably removing some data which is used by the XHTML code...

               

              Harbs

              • 4. Re: Strange interaction with XHTML For Digital Editions
                liedzeit Level 2

                Hi Michel,

                could you insert an empty line in your code to verify that line 381 (or then 382) is causing the error? (one of my scripts is also used by the customer but line 381 is a comment.)

                 

                Ralf

                • 5. Re: Strange interaction with XHTML For Digital Editions
                  Dirk Becker  Level 4

                  Michel,

                   

                  to reduce confusion let's call a script a script rather than plugin, even if it is delivered as jsxbin.

                   

                  Isolation into a target engine is good, but the target engine is not at all indicated by the error message, so do not assume this is an issue.

                   

                  The error is about a strange file "6" containing at least those 381 lines, which during initial execution (when its functions were defined / installed) was located within that XHTML for Digital Editions subdirectory. If there is no such file, it could already be removed when the error pops up, who knows. That is, unless InDesign lies about the source file, but I have never heard of that.

                   

                  It would now be good to know who created that presumed temporary file containing 381 lines of executable code, e.g. by accidentally using a wrong path. One possibility is the implicit reference to the "Folder.current" variable by a relative path - do you use relative paths anywhere? Folder.current is explained in JavaScript Tools Guide available from ESTK Help.

                   

                  It would also be good to know whether your script uses try-catch brackets in all its entries (menu callbacks or other handlers), or why not. If this is new to you, this way you can intercept any system error message like the quoted one which is a very generic one, and add your own comments such as "while performing this/that task" or other context information. You could then also recover gracefully from any errors such as a stale references to a deleted object. For the beginning though, you can at least find out whether the problem is at all within your code.

                   

                  It is also generally good practice to have an option ready in source code that produces an exhaustive log file for any general steps but also caught error messages. It is not like walking around with a debugger, but you can find out the call chain and general area of code involved when the dreaded dialog pops up again.

                   

                  Finally if it is the same problem as mentioned by Ralf, you should better get in direct contact with him - this forum has a personal mail feature and probably both of you have a phone ;-) .

                   

                  Dirk

                  • 6. Re: Strange interaction with XHTML For Digital Editions
                    scriptworker Level 1

                    Hello Dirk,

                     

                    I am sure now that Indesign is lying about the source of the error

                    and that the error is in my own script.

                     

                    1. I have removed the XHTML For Digital Editions scripted plugin.

                    Indesign is now giving this path as the errorsource:

                     

                    C:\Users\Michel\Documents\6

                     

                    There is no file "6" in my Documents folder.

                     

                    2. I know now that the error in my first posting is in my own script and

                    that it stops at line 381. I have changed the order of execution and now

                    another line in my script is displayed as the errorsource and it's stopping

                    at the same code.

                     

                    So Indesign is definitely lying about the filename. I think this happens

                    with .jsxbin files. The question is why?

                     

                    Any ideas?

                     

                    Michel

                    • 7. Re: Strange interaction with XHTML For Digital Editions
                      Harbs. Level 6

                      I've never seen anything like that. Without seeing your code, I would 

                      not even know where to begin guessing...

                       

                      Harbs

                      • 8. Re: Strange interaction with XHTML For Digital Editions
                        Dirk Becker  Level 4

                        Harbs is right on that we're at a level of flat guessing. My first guess is that the 6 is the 6th invokation of something temporary, along the lines below.

                        Note that with this script, executing straight from ESTK, I did not see any message close to yours. The access of the deleted tf within the alert was intended to reproduce the error number, but here it gives just a flat "Undefined". So it must be a different way - could be app.doScript, $.evalFile, #include, or maybe the menu handlers number themself ? anonymous functions, or any combination of these possibilities?

                         

                        // padding

                        // padding

                        var whine = "\

                        var tf = app.activeDocument.pages.item(0).textFrames.add();\

                        tf.remove();\

                        alert(tf.contents);\

                        ";

                        // more padding

                        eval(whine);

                        Dirk