4 Replies Latest reply on Feb 20, 2012 5:50 AM by Muppet Mark

    How can I access the int value of an enum?

    dserodio

      The ExtendScript Toolkit's Object Model Viewer shows an integer value for each instance of an enumerated type. For instance, the documentation for BlendMode contains "COLORBLEND: int, Value: 22", among others.

      How can I access this "22" value from within ExtendScript (Javascript)?

       

      Thanks in advance,

      Daniel Serodio

        • 1. Re: How can I access the int value of an enum?
          Muppet Mark Level 5

          You may be able to reflect() this kind of info just don't ask me how that works… Else you could utilize the app's omv.xml They are in application support folder…

          • 2. Re: How can I access the int value of an enum?
            dserodio Level 1

            Thanks for your reply, but unfortunately it didn't work. BlendMode.NORMAL.reflect.properties prints the following:

             

            __proto__,__count__,__class__,reflect

             

            omv.xml doesn't contain the int value of an enumeration's values either.

            • 3. Re: How can I access the int value of an enum?
              Michael L Hale Level 5

              ExtendScript does not use the integer value for enumerations. I am not sure why the Object Model viewer lists them. You can also find them in the VBScript reference as they are used in that scripting language.

              • 4. Re: How can I access the int value of an enum?
                Muppet Mark Level 5

                I snipped this out of my omv file… The value is listed…

                 

                        <property name="SATURATION" rwaccess="readonly">

                          <shortdesc>Creates a result color with the luminance and hue of the base color and the saturation of the blend color. Painting with this mode in an area with no (0) saturation (gray) causes no change.</shortdesc>

                          <datatype>

                            <type>int</type>

                            <value>21</value>

                          </datatype>

                        </property>

                        <property name="COLORBLEND" rwaccess="readonly">

                          <shortdesc>Creates a result color with the luminance of the base color and the hue and saturation of the blend color. This preserves the gray levels in the image and is useful for coloring monochrome images and for tinting color images.</shortdesc>

                          <datatype>

                            <type>int</type>

                            <value>22</value>

                          </datatype>

                        </property>

                        <property name="LUMINOSITY" rwaccess="readonly">

                          <shortdesc>Creates a result color with the hue and saturation of the base color and the luminance of the blend color. This mode creates an inverse effect from that of the Color mode.</shortdesc>

                          <datatype>

                            <type>int</type>

                            <value>23</value>

                          </datatype>

                        </property>