14 Replies Latest reply on Aug 4, 2008 12:39 PM by (Dave_Saunders)

    script error

    Level 1
      { var theCodes = [[1096971116, ["absolute", "absolute numbering"]], nbsp; [1935897710, ["section", "section numbering"]]];
        • 1. Re: script error
          Level 1
          maybe "nbsp;" ??

          robin

          --
          www.adobescripts.com
          • 2. Re: script error
            Level 1
            its not the error.... i checked, thanks anyways
            • 3. Re: script error
              Level 1
              So what is the error message? That line is an incomplete fragment from something larger and there isn't enough context for us to evaluate it. The nbsp; is definitely wrong and shouldn't be there.

              Dave
              • 4. Re: script error
                Level 1
                The complete coding is given below:

                app.generalPreferences.pageNumbering = [PageNumberingOptions.section,
                PageNumberingOptions.absolute][0];
                alert(decodePageNumbering(app.generalPreferences.pageNumbering,true));
                function decodePageNumbering(theCode,verbose)
                { var theCodes = [[1096971116, ["absolute", "absolute numbering"]],   [1935897710, ["section", "section numbering"]]];
                var verbosePtr = 0; if (verbose) { verbosePtr = 1 }
                switch (theCode)
                { case PageNumberingOptions.absolute :
                return theCodes[0][1][verbosePtr];
                case PageNumberingOptions.section :
                return theCodes[1][1][verbosePtr];
                default : throw (String(theCode) + "not recognized") }}

                Script Description: This script is intended to display page numbers staring from 0.However it is not woking and is giving the following error on running:

                Java Script Error
                Error number :25
                Line : 5
                Source:{ var theCodes = [[1096971116, ["absolute", "absolute numbering"]], nbsp;[1935897710, ["section", "section numbering"]]];
                Offending Text: ;

                After removing the   a dialog box with " Section Numbering " written on it is displayed....

                Please help me in debugging this code....

                THANKS
                • 5. Re: script error
                  Level 1
                  You have something weird in your source code that is being interpreted as nbsp; (looks like   -- HTML for non-breaking-space) in that line of code. Delet everything between the , and [ where that text appears in the error message.

                  This is at least the third time that this has been pointed out to you.

                  Dave
                  • 6. Re: script error
                    Level 1
                    After removing nbsp;, the code is running but is not giving the desired output. A dialog box with "Section Numbering" written on it is displayed.....
                    • 7. Re: script error
                      [Jongware] Most Valuable Participant
                      Suvo,

                      Do you understand the script? As far as I can see, it
                      b will
                      display a dialog box with "section numbering" (or "absolute numbering", or "xxx not recognized"). So, you have section numbering and want something else? Well, this script doesn't
                      b do
                      that. It merely tells what the settings in your document are, not tomorrow's lottery numbers or anything.

                      >Script Description: This script is intended to display page numbers staring from 0

                      In that case it just doesn't do what the description says it does.
                      • 8. Re: script error
                        Level 1
                        Yes i think you are right.Can you give me some script which can numbr the pages from 0 instead of 1....

                        Thanks
                        • 9. Re: script error
                          [Jongware] Most Valuable Participant
                          Such a script is not possible.

                          A script can't do anything that you can't do in the user interface. You can't do that in the user interface. Therefore, you can't do it with a script.
                          • 10. Re: script error
                            Level 1
                            Hi suvoWillShine,

                            To have the page numbering of a document start at zero, you need two sections: one for the first page, and one for all succeeding pages. The numbering start of the first page doesn't matter--instead of using an automatic page number marker, simply enter zero wherever you'd like the page number to appear. The second section should start with page 1, and you can use the page number marker on all subsequent pages.

                            This accomplishes what you want to do without trying to do something that cannot be done. Did that make sense?:-)

                            Thanks,

                            Ole
                            • 11. Re: script error
                              Peter Kahrel Adobe Community Professional & MVP
                              >A script can't do anything that you can't do in the user interface. You can't do that in the user interface. Therefore, you can't do it with a script.

                              Well... In the interface you can search the current document, all documents, a selection, and to the end of the story. That's it. In a script you can search a textframe, a paragraph, a word, a table column, an insertion point (not sure what you'd hope to find there) -- you name it.

                              Peter
                              • 12. Re: script error
                                Level 1
                                But in the interface, you can select all those searchable objects and then search them using the Selection choice.

                                On the other hand, in a script, there are four choices for balance ragged lines while in the UI there are only two.

                                Dave
                                • 13. Re: script error
                                  [Jongware] Most Valuable Participant
                                  Wot!!

                                  (Checking, please wait.)

                                  BalanceLinesStyle
                                  
                                  NO_BALANCING Does not balance lines.
                                  VEE_SHAPE Prefers shorter last lines.
                                  FULLY_BALANCED Balances lines equally.
                                  PYRAMID_SHAPE  Prefers longer last lines.

                                  Now you've done it. Now I have to try them all and find my
                                  i preferred
                                  one. When it was so easy ... on or off ...

                                  Any particular reason this is in scripting but not the UI? And, are there any more of these hidden gemlets? (I'm not talking about the rainbow lines.)
                                  • 14. Re: script error
                                    Level 1
                                    I think this was a case of the feature being downgraded late in a release and scripting didn't have time to backtrack from the fuller support.

                                    It doesn't work very well. There's almost no difference between fully balanced and vee-shape half the time.

                                    So, they backed off the feature in the UI.

                                    I think this is the only case of this sort of thing that I know of.

                                    Dave