7 Replies Latest reply: Oct 5, 2012 11:19 PM by Carl Sun RSS

    Illustrator path to Presets/Scripts including locale

    orgicus Community Member

      Hi,

       

      I've made a little jsx Illustrator script I'd like to pack as an extension.

      Looked at MXI tech note Path Tokens appending and found the $presets token.

      Unfortunately it does NOT include the locale in it's path.

       

      For example, my path is /Applications/Adobe Creative Suite 5/Adobe Illustrator CS5/Presets.localized/en_GB/Scripts

      For other locales that will be different and the $presets toke doesn't help, it's the sames as $illustrator/Presets.localized as far as I can tell.

       


      How can can I set the path of my script to Illustrator's Scripts folder from my MXI ?

        • 1. Re: Illustrator path to Presets/Scripts including locale
          Carl Sun Adobe Employee

          There is no such token you can use directly. I figured out this problem, but it requires some simple change in Illustrator. The following is my experiment:

          1. Add the following line to XManConfig.xml of Illustrator:

          <Data key="$localizedPresets">$presets/$LOCALE</Data>

          Please add this line after the following line:

          <Data key="$presets">$InstallFolder/../../../Presets</Data>

          2. Define the destination of your file to "$localizedPresets/Scripts"

          After that, the file will be installed to the correct location you want.

           

          I think the best solution is Illustrator add this line itself. We can suggest Illustrator add this line in its next release.

          • 2. Re: Illustrator path to Presets/Scripts including locale
            orgicus Community Member

            Hello Carl,

             

            Thank you very much for taking your time for this.

            It looks promising, but unfortunately this doesn't fully work as expected.

             

            I've updated XManConfig.xml as advised and repackaged/installed my script

            but it gets written into en_US instead of en_GB.

            Not sure how the $LOCALE token works.

             

            The 'workaround' I have in place at the moment works, but it's pretty messy/hacky:

            I copy the script for EVERY locale illustrator has.

            Even with this, I'm not sure if all the possible install locales are the ones that are listed

            in the Illustrator Download page:

             

             

            <!-- Illustrator Install Locales -->
                      <file source="Save Selection Coordinates.jsx" destination="$presets/cs_CZ/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/da_DK/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/nl_NL/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/en_GB/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/en_US/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/fr_FR/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/en_GB/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/de_DE/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/it_IT/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/ja_JP/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/ko_KR/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/pl_PL/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/ru_RU/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/es_ES/Scripts/" shared="true" />
                      <file source="Save Selection Coordinates.jsx" destination="$presets/sv_SE/Scripts/" shared="true" />
            

             

             

            or the ones used in the legal notes:

             

             

             

            <!--All legal locales-->
            <file source="Save Selection Coordinates.jsx" destination="$presets/ar_AE/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/cs_CZ/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/da_DK/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/de_DE/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/el_GR/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/en_GB/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/en_US/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/es_ES/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/es_MX/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/fi_FI/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/fr_CA/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/fr_FR/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/he_IL/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/hu_HU/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/it_IT/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/ja_JP/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/ko_KR/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/nb_NO/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/nl_NL/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/pl_PL/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/pt_BR/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/ro_RO/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/ru_RU/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/sv_SE/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/tr_TR/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/uk_UA/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/zh_CN/Scripts/" shared="true" />
            <file source="Save Selection Coordinates.jsx" destination="$presets/zh_TW/Scripts/" shared="true" />
            
            

             

             

             

            I really hope you're solution can be tweaked to work as it would be cleaner to update XManConfig.xml along with the script than making loads of unneccesary copies.

             

            Regarding the next release, yes, the localized presets token would be very helpful.

            • 3. Re: Illustrator path to Presets/Scripts including locale
              Carl Sun Adobe Employee

              I verified it using fr_FR and zh_CN, it works fine. I didn't use en_GB.

               

              The locale is determined by several factors: the value of "DefaultLocale" in XManConfig.xml of products, the UI language of Extension Manager, the language selected by user when prompted by Extension Manager in rare cases.

              For examples, if you launch Extension Manager with French locale (in French OS or using command line parameter -locale lang="fr_FR"), the files will be installed to fr_FR sub-directory, even if your Illustrator is english version. But if you launch Extension Manager using command line parameter -locale lang="en_GB", the files will be still  installed to en_US sub-directory, since Extension Manager supports 22 different locales, not including separate support for en_GB.

              If you change "DefaultLocale" to "en_GB" in  XManConfig.xml of Illustrator, then launch Extension Manager with en_US locale, the files will be installed to en_GB sub-directory.

              • 4. Re: Illustrator path to Presets/Scripts including locale
                Guo Liu Adobe Employee

                Hi,

                 

                According to the "Packaging Extensions with Extension Manager CS5" document,Extension Manager determines the correct language by completing these steps, listed in order of priority:
                1 The language of the point product (defined in XManConfig.xml file for point product).

                     The key name is "DefaultLocale" in XManConfig.xml.
                2 The language of the Extension Manager interface.

                     If thelanguage of your Extension Manager is English, this value is "en_US", Extension Manager does not support "en_GB" as the specified interface language.
                3 The language selected by the user when prompted by Extension Manager.
                4 If the extension doesn’t provide files for the user-selected language, Extension Manager installs files specified by the "defaultLanguage" tag in .mxi file.

                 

                Please check what the value is for the "DefaultLocale" key of the XManConfig.xml file.

                 

                Thanks,

                Guo Liu

                • 5. Re: Illustrator path to Presets/Scripts including locale
                  orgicus Community Member

                  Thank you very much for the explanations Carl and Guo !

                   

                  This is a lot more convoluted than I imagined. Probably on a higher level, this locale setup makes

                  sense, but for me as a mere user, it seems a bit more complicated than perhaps it should be.

                   

                  Carl, your idea("If you change "DefaultLocale" to "en_GB" in  XManConfig.xml of  Illustrator, then launch Extension Manager with en_US locale, the files  will be installed to en_GB sub-directory.") is ok, but that will only work for en_GB users.

                   

                   

                  Guo, in my XManConfi.xml file DefaultLocale is indeed en_US :

                  <Data key="DefaultLocale">en_US</Data>

                   

                  Wish I could run a js script to check if a locale folder exists or something similar (cd $illustrator/Presets, ls >> locale.txt, etc.)

                   

                  At the end of the day, it seems I don't have a clean solution for my problem: making sure an extensions copies the script into

                  the correct folder on other users' machines.

                  • 6. Re: Illustrator path to Presets/Scripts including locale
                    brian.e. Community Member

                    Is this related to the problem in Illustrator that you can not add a script into the actions that will stay there even after a relaunch?  If so do you know of a solution to this issue problem?  The only way I know of to get a script inside of actions is to use the "Insert Menu Item" & the "Other Script" but this is not user freindly.

                    • 7. Re: Illustrator path to Presets/Scripts including locale
                      Carl Sun Adobe Employee

                      This issue seems to have nothing to do with what you said. I think you should post your question to http://forums.adobe.com/community/illustrator/illustrator_scripting. Maybe someone can help you there.