5 Replies Latest reply on Oct 8, 2013 2:44 AM by Jump_Over

    Ability to share scripts among users on the same Mac

    Thomas--911

      Hi,

       

      In our design studio we use InDesign with a few scripts to automate tasks. The problem is that when a users changes from one Mac to another, the scripts have to be installed manually in the correct location. Is there a way that I can put the scripts in a folder (lets say /User/share/Indesign_Scripts") and that Indesign will always use that location?

       

      For now I copied the scripts into the user-template in /etc, but this doens't work always because some users use different language settings (en_GB -> en_US)

        • 1. Re: Ability to share scripts among users on the same Mac
          Andreas Jansson Level 2

          Could you explain the thing about different language settings, and why it matters when it comes to copying the scripts?

           

          A suggestion that might be useful to you:

               Folder shortcuts (and the equivalence in the apple os) do show up in the scripts panel in InDesign. Some of our customers put their common scripts in a shared folder on a network server. This way they ensure that all users access the same scripts, that updates to the scripts are immediate and that no computer is forgotten. To get this to work they just put a shortcut to the network folder inside the indesign scripts folder on every computer.

          • 2. Re: Ability to share scripts among users on the same Mac
            Jump_Over Level 5

            Hi,

             

            Shortcuts are good, even if some people are get lost in front of alerts 'Can't find original file'..., but not in Design Studio, I am sure.

             

            I tested another way which works, so there is no reason to keep it hide.

             

            3 kind of scripts:

            -----------------------

            1st - simple one is placed in each user "Startup Scripts" folder:

             

            It looks like this:

            #targetengine "menu"
            var myScPath = "~/Shared/Scripts/Studio_menu.jsx";
                 if (File (myScPath).exists)
                              app.doScript(File(myScPath));
                 else alert ("No network file find..., or whatever alert");
            

             

            -----------------------

            2nd is menu loader ("Studio_menu.jsx), so this one which 1st script is calling while ID starts.

            It looks like this:      (thanks to Marc Autret)

             

            #targetengine "Scripts"
            
            var fcaTitle = "Scripts";          // name (parent menu item) displayed in ID menu
            var fcaSubTitle1 = "&Task1";     // name (name of script) displayed in ID menu
            var fcaSubTitle2 = "&Task2";    // name (name of script) displayed in ID menu
            
            var fcaHandlers1 = {
                      'beforeDisplay' : function(ev1)
                                {
                      mySc1Path = "~/Shared/Scripts/Task1.jsx";     // script, executor of task 1
                      ev1.target.enabled = File(mySc1Path).exists;
                                },
            
                      'onInvoke' : function()
                                {
                                app.doScript(File(mySc1Path));
                                }
                      };
            
            var fcaHandlers2 = {
                      'beforeDisplay' : function(ev2)
                                {
                      mySc1Path = "~/Shared/Scripts/Task2.jsx";     // script, executor of task 2
            
                      // conditions to enable/disable menu item
                      ev2.target.enabled = File(mySc2Path).exists && app.documents.length > 0 && app.activeDocument.saved;
                                },
            
                      'onInvoke' : function()
                                {
                                app.doScript(File(mySc2Path));
                                }
                      }
            
            var fcaMenuInstaller = fcaMenuInstaller ||
            (function(mnuTitle, mnuSubTitle1, mnuSubTitle2, mnuHandlers1, mnuHandlers2)
            {
            // 1. Create the script menu action
            
            var s1mnuAction = app.scriptMenuActions.add(mnuSubTitle1);
            var s2mnuAction = app.scriptMenuActions.add(mnuSubTitle2);
            
            // 2. Attach the event listener
            var ev1, ev2;
            for( ev1 in mnuHandlers1 )
                      {
                      s1mnuAction.eventListeners.add(ev1,mnuHandlers1[ev1]);
                      }
            for( ev2 in mnuHandlers2 )
                      {
                      s2mnuAction.eventListeners.add(ev2,mnuHandlers2[ev2]);
                      }
            
            // 3. Create the menu item
            var fileMenu = app.menus.item("$ID/Main").submenus.item("$ID/&Help");  // new menu item's location
            
            var SubMenu = fileMenu.submenus.add(mnuTitle,LocationOptions.AT_BEGINNING);     // where
            var SubMenu1 = SubMenu.menuItems.add(s1mnuAction,LocationOptions.AT_END);
            var SubMenu2 = SubMenu.menuItems.add(s2mnuAction,LocationOptions.AT_END);
            
            return true;
            })(fcaTitle, fcaSubTitle1, fcaSubTitle2, fcaHandlers1, fcaHandlers2);
            

             

            ---------------------

            3rd one are the real script files placed somewhere in network (mySc1Path1, mySc1Path2)

            Users invoke scripts from menu.

            Admin updates them easly.

             

            Jarek

            • 3. Re: Ability to share scripts among users on the same Mac
              Thomas--911 Level 1

              HI Andreas,

               

              These are the locations where I batch-copy all the scripts to, just to have them work with CS6 (8.0) and Creative Cloud (9.0). Some users tend to change the language of the license agreement to US english or Britisch english (our only 2 choices), this is why to copy is executed for every language.

               

              Now when a new users logs in using their active directory account, a new user profile gets created based on "/System/Library/User\ Template/English.lproj" and thus all the needed scripts are in place.

               

              The only downside to this is that it's a real hassle to update the scripts or when Adobe does another update.

               

              /System/Library/User\ Template/English.lproj/Library/Preferences/Adobe\ InDesign/Version\ 9.0/en_US/Scripts/Scripts\ Panel/

              /System/Library/User\ Template/English.lproj/Library/Preferences/Adobe\ InDesign/Version\ 8.0/en_US/Scripts/Scripts\ Panel/

              /System/Library/User\ Template/English.lproj/Library/Preferences/Adobe\ InDesign/Version\ 9.0/en_GB/Scripts/Scripts\ Panel/

              /System/Library/User\ Template/English.lproj/Library/Preferences/Adobe\ InDesign/Version\ 8.0/en_GB/Scripts/Scripts\ Panel/

              • 4. Re: Ability to share scripts among users on the same Mac
                Thomas--911 Level 1

                Hi Jump_Over,

                 

                Where should I place the 2nd script? this looks like the ideal solution!

                • 5. Re: Ability to share scripts among users on the same Mac
                  Jump_Over Level 5

                  Hi,

                   

                  variable var myScPath from the 1st script should be a 2nd one location.

                   

                  Jarek