5 Replies Latest reply on Jun 21, 2013 10:16 AM by Michael L Hale

    Reserved words

    Ghoulfool Level 1

      I just discovered that "name" is a reserved word. Or at least if you create a variable called name it'll ignore it.

       

      alert(name)
      

       

      Adobe Photoshop

       

      Is there a list reserved words in photoshop scripting somewhere so I can avoid them?

      Cheers

        • 1. Re: Reserved words
          Michael L Hale Level 5

          I don't know if there is a list of reserved words for the Photoshop version of ExtendScript. But this is not really a reserved word. Because app. is optional app.name and name point to the same application property( which is read-only ). So you could look in the guide under app.properties for a list of variable names to avoid.

          1 person found this helpful
          • 2. Re: Reserved words
            Ghoulfool Level 1

            Thanks for that.

            variable names to avoid:

            activeDocument, backgroundColour, colourSettings, displayDialogs, documents, fonts, foregroundColour, freeMemory, locale, macintoshFileTypes, name, notifiers, notifiersEnabled, path, playbackParameters, preferences, preferencesFolder, scriptingVersion, typename, version, windowsFileTypes

            • 3. Re: Reserved words
              pixxxel schubser MVP & Adobe Community Professional

              Ghoulfool wrote:

               

              I just discovered that "name" is a reserved word. Or at least if you create a variable called name it'll ignore it …

               

              You can also use:

              Name

              _name

              DocName

              and so on (for your variables instead). It looks like a kind of own style of every programmer.

               

               

              • 4. Re: Reserved words
                Ghoulfool Level 1

                I've done this before; it's born out of unimaginative variable names.

                • 5. Re: Reserved words
                  Michael L Hale Level 5

                  There are a lot of other name you should avoid. In ESTK start any Photoshop script with a breakpoint one the first line. In the data browser window you will see a long list of already defined objects. Depending on what other Adobe apps and start-up scripts you have install it may be a very long list. And at least for me some of the items in that list are surprising. On my system i is already defined and set to 0 before any script I run can define it. That hasn't been a problem for me but I didn't expect to find it.