8 Replies Latest reply on Dec 29, 2016 6:22 PM by geordiem74078114

    Best place for JSX files shared across multiple products

    geordiem74078114 Level 1

      Hi all, I was wondering what's the best option for shared tools over multiple Adobe products?

      Example:  I have a polyfill script which extends extendscript built in objects that I'd like automatically loaded in Photoshop, Illustrator, Premiere and After Effects before any panel code is executed.

       

      1. Make a silent panel which registers a bunch of functions, classes etc on startup.  If so how can I determine panel load order?

      2. Put a jsx file somewhere in C:\Program Files (x86)\Common Files\Adobe

      3. C:\Program Files\Common Files\Adobe\Startup Scripts CC.  Still working out if this is an option...

      4. ?

       

       

      Thanks!

       

      Geordie

        • 1. Re: Best place for JSX files shared across multiple products
          JavierAroche Level 3

          Hey geordiem74078114, You can place your JSX file in your Adobe Scripts folder. You can actually put it wherever you want, but this is a folder that is created when you install an Adobe product (it might just be photoshop?).

          ~/Documents/Adobe Scripts/

           

          You can then include that file in any script that you're building by adding this line at the beginning of your code

          #include "~/Documents/Adobe Scripts/script.jsx"
          

           

          #include is similar to a require in JavaScript. After you include your file, you will be able to use its functions.

           

          Hope that helps.

          1 person found this helpful
          • 2. Re: Best place for JSX files shared across multiple products
            JJMack Most Valuable Participant

            I only use Photoshop but I have many versions of Photoshop installed. All versions of Photoshop  use the same copy of the scripts I add to Photoshop.    I Install Scripts I add into a Photoshop Scripts tree on my C: drive and I link all Photoshop versions installed Presets\Scripts\ folder to my Photoshop scripts tree.   I use sub folders just to help me remember what is what.   When Photoshop starts up it scan the full tree and scripts are listed in menu File>Scripts and my Plug-in scripts are listed in menu File>Automate like the should be.

            • 3. Re: Best place for JSX files shared across multiple products
              geordiem74078114 Level 1

              Thanks guys, yeah I use a lot of includes but was wondering if there was an official way as I'd like to avoid executing the shared scripts every time something references it, but I can minimize that with some logic.

               

              I found this in the Photoshop CC Scripting Guide:

              "On startup, Photoshop executes all .jsx files that it finds in the startup folders.

              ➤ On Windows, the startup folder for user-defined scripts is: C:\Program Files\Common Files\Adobe\Startup Scripts CC\Adobe Photoshop

              ➤ On Mac OS, the startup folder for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CC/Adobe Photoshop

               

              If your script is in this main startup folder, it is also executed by all other Adobe Creative Suite 6 applications at startup."

               

              I just tried adding a file here:

              C:\Program Files\Common Files\Adobe\Startup Scripts CC\

               

              But it didn't seem to be executed by Photoshop or Premiere.

              • 4. Re: Best place for JSX files shared across multiple products
                geordiem74078114 Level 1

                I think I'll set an environment variable in the install process with script paths and use $.getenv to access it

                • 5. Re: Best place for JSX files shared across multiple products
                  Tom Ruark Adobe Employee

                  Which version of Photoshop? If CS6 then put them here as well: C:\Program Files (x86)\Common Files\Adobe\Startup Scripts CS6

                  • 6. Re: Best place for JSX files shared across multiple products
                    geordiem74078114 Level 1

                    Hi Tom, I actually want scripts to be loaded in Photoshop, Illustrator, Premiere and After Effects CC.  This is basic stuff like extending Object and String types in Extendscript.

                     

                    Do you know if adding scripts here:

                    C:\Program Files\Common Files\Adobe\Startup Scripts CC\

                    Should work as stated in the CC Scripting Guide?  I was looking at the CC guild but that particular part only mentions CS6.

                     

                    Thanks!

                    • 7. Re: Best place for JSX files shared across multiple products
                      Tom Ruark Adobe Employee

                      You can do runtime checks for host app. I would use (x86) in Program files unless you are on a non 64 bit machine then it would be Program Files without the x86. That common location for 32 bit is used by the 64 bit apps. See the photoshop.jsx to see runtime choices we make to get them running in the correct application.

                      • 8. Re: Best place for JSX files shared across multiple products
                        geordiem74078114 Level 1

                        Hi Tom, thanks for your reply, not sure if we're on the same page, I basically want to put a single JSX file somewhere that's executed by All (well the basics like Photoshop, Illustrator, Premiere and AfterEffects) adobe products on startup.  My scenario is I'm creating CEP Panels for PPro and AfterEffects.  I have a JSX file which polyfills some parts of ECMAScript that I just want globally available.  I'm trying to avoid having code at the start of every different panel that checks for the upgrades.

                         

                        Like I previously said:

                        I found this in the Photoshop CC Scripting Guide:

                        "On startup, Photoshop executes all .jsx files that it finds in the startup folders.

                        ➤ On Windows, the startup folder for user-defined scripts is: C:\Program Files\Common Files\Adobe\Startup Scripts CC\Adobe Photoshop

                        ➤ On Mac OS, the startup folder for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CC/Adobe Photoshop

                         

                        If your script is in this main startup folder, it is also executed by  *** ALL *** other Adobe Creative Suite 6 applications at startup."

                         

                        I've tried adding a jsx these these folders:

                        C:\Program Files (x86)\Common Files\Adobe\Startup Scripts CC

                        C:\Program Files\Common Files\Adobe\Startup Scripts CC

                         

                        Basically from what the docs say that file should get executed by all adobe apps at startup, but it doesn't.

                         

                        Back in the days of Flash panels you could have a shared library but not sure how to do the same thing with HTML panels.