3 Replies Latest reply on Jan 17, 2011 3:20 AM by [Jongware]-9BC6tI

    Find xml structure errors for font styles in Indesign

    Robin_dv

      Dear all,

       

      Its been a great pleasure to get perfect responce  from yours (Haakenlid, Marc..), Today m facing a problem while scripting for Indesign the problem is

      We have an xml based pagination system, and I have to check all words which have font styles  bold, semibold, italic, semibold, bolditalic,mediumitalic and much more in Indesign but not having corresponding xml tags like fe:boold for Bold style...

       

      I have achived to find all words which are having Bold style and not have corresponding xml tag but its find Headings too in Indesign which having bold style..

      can we find all bold style words except headings and write a log for that....

        • 1. Re: Find xml structure errors for font styles in Indesign
          [Jongware]-9BC6tI Level 4

          Sure. Can you show what you have got so far?

          • 2. Re: Find xml structure errors for font styles in Indesign
            Robin_dv Level 1

            Ya sure,

             

            Here is the code fragment i have find for the testing for bold style but it just find all headings which has a bold styles in it.... Can we have a different logic rather than this..

             

             

            function Testing_For_Bold()

            {

            result=0;

            app.findTextPreferences = null;

            app.findTextPreferences.fontStyle = "Bold";

             

            result = app.activeDocument.findText();

            var bldLnth=0;

            bldLnth=result.length;

            for (i=0; i<bldLnth;i++)

            {

            var myElemAtt="";

            var myElem=result[i].associatedXMLElements[0].markupTag.name;

            try{

            myElemAtt=result[i].associatedXMLElements[0].xmlAttributes.item("id").value;

            }catch(err){

            }

             

            if(myElem == "fe:blad")

            {

            //alert("Bold tag is found  "+myElem);

            //$.writeln ("Bold tag is found  "+myElem);

            }

            else

            {

            alert("No Bold tag is found for the text  \""+result[i].contents) ;

            }

            }

            }

            • 3. Re: Find xml structure errors for font styles in Indesign
              [Jongware]-9BC6tI Level 4

              Okay, I see the problem. Try this: in the loop where you check the results, first check if the paragraph style of that text has 'Bold' as its font style. If so, you can skip it right away.

               

              Something like:

               

              for (i=0; i<bldLnth;i++)

              {

                if (result[i].appliedParagraphStyle.fontStyle == "Bold")

                  continue;

              ...

               

               

              (Sorry, I tried to apply Javascript formatting to this piece of code, but apparently the Jive Editor f*** messed it up again. It's a disgrace and an embarressment to Adobe to make its forum members use it.)