4 Replies Latest reply on Mar 20, 2013 7:16 AM by DBarranca

    enable-info grammar

    DBarranca Level 4


      is there anyone grasping the basics of the <enableinfo> tags?

      I'm quite stuck at page 190 of the JS Reference (what does that table mean I can't say - an example could have helped!)


      I've been able to make a script which is disabled in the Filters menu unless a document is open:




      I can get a single statement too, like "show if the document mode is not IndexedColor":


      <enableinfo>PSHOP_ImageMode != IndexedMode</enableinfo>


      And that's all. I couldn't be able to link statements (the following doesn't even make the script to show up in the menu):


      <enableinfo>PSHOP_ImageMode != IndexedMode && PSHOP_ImageMode != BitmapMode</enableinfo>


      Has anyone some example of use?

      And - I'm probably close minded - but what the heck does it mean:


      <equality> := <simpleExpression> {<equalityOperator><simpleExpression>}


      Thanks in advance!


        • 1. Re: enable-info grammar
          pixxxel schubser MVP & Adobe Community Professional

          Hopefully I did not understand the question completely wrong.



          var aDoc = app.activeDocument;
          var ColourMode = aDoc.mode;
          alert( ColourMode );
          • 2. Re: enable-info grammar
            DBarranca Level 4


            I'm afraid I'm doing something different.

            I can test the document mode - but the <enable-info> tag checks whether the script (appearing in the Filter or Automate menu) is enabled or grayed out depending on the conditional it expresses.




            • 3. Re: enable-info grammar
              Mikaeru69 Level 3

              Hi Davide,


              There are a few hints at the beginning of the "JavaScript Resource" chapter, p. 189 of the "Adobe Photoshop CS6 JavaScript Scripting Reference" document, among which the last one may be the key to the problem:


              • The strings must be valid XML syntax. The "&" character will not work for example. Use the &amp;&amp; for example to get logical ‘&&’ in the enableinfo block.





              • 4. Re: enable-info grammar
                DBarranca Level 4

                There are a few hints at the beginning of the "JavaScript Resource" chapter


                Sometimes Photoshop scripting is kind of a treasure hunt you've to look for hints!

                Thanks Mikaeru, I'll give that a try!