20 Replies Latest reply on Nov 8, 2013 10:19 PM by Jeremy Knudsen

    Including Action

    leuallen-BfBe3G
      When making an .mxp file to share, the actions that I call for are not included with the package. Thus the panel does not work for the user who installs the .mxp file. Originally the action files were located in my own folder.That did not work. Copied the required action files to Photoshop/Presets/Actions. Built everything anew. Did not work. Copied action files to Panel/mypanel/content. Repeat - did not work.

      Do I have to include a copy of my actions with the .mxp file and have the user install them? That does not sound right. How do I get my actions to be included with the .mxp file so that they are installed on the users machine?

      Larry
        • 1. Re: Including Action
          leuallen-BfBe3G Level 1
          Just noticed that the .mxp install has the action files under the content folder. They just don't get installed in PS so that they can be used. I will close PS, Configurator, everything, and unistall the extenstion. Retry installing. Maybe I had PS open and that doesn't work?

          Larry
          • 2. Re: Including Action
            Level 7
            I believe you have to edit one of the files to point to the files you want
            to include in the MXP file. Not sure right now I am having some freaky color
            issues with configurator. However, I hope in the very near future that
            Configurator is smart enough that when you include a script or action that
            it automatically bundles them witht he panel so that when you create the MXP
            file using extension manager that they are included. Having to go in and
            edit a file with a notepad program is just poor form for modern software.

            Robert

            • 3. Re: Including Action
              leuallen-BfBe3G Level 1
              I finally got the actions included in the .mxp by placing a copy of them in the PanelName/contents folder along with the .js files. The problem is that when the extension is installed, the actions are not installed into Photoshop. It must be done manually. This confuses people who try to use your extension.

              Larry
              • 4. Re: Including Action
                Level 7
                I believe if you want them installed you have to edit the file so that they
                are listed. This is covered someplace on the labs site for Configurator. You
                do have to manually edit the file.

                Robert

                • 5. Re: Including Action
                  leuallen-BfBe3G Level 1
                  Where is the labs site for Configurator? I need all the help I can get.

                  What file to edit? I opened the .mxp and that is binary. There seems to be nothing in .mxi of importance to edit.

                  Larry
                  • 7. Re: Including Action
                    Level 7
                    Take a look at the "files" tag. This information is added to the mxi file
                    using a text editor.

                    Robert

                    • 8. Re: Including Action
                      Level 7
                      Also, take a look at:

                      http://blogs.adobe.com/jnack/files/ConfiguratorUserGuide.pdf

                      Unfortunately, I don't remember which of the links has the simplified
                      information, but they should have what you need.

                      Robert

                      • 9. Re: Including Action
                        leuallen-BfBe3G Level 1
                        Thanks Robert. Will delve into topic when done wrestling with Lightroom customization.

                        Larry
                        • 10. Re: Including Action
                          zhpingw Level 2
                          You can open panel.mxi file and modify it like these:

                          <files>
                          <file source="content" destination="$panels/TestColorPicker/" />
                          <file source="myaction.atn" destination="$actions"/>
                          </files>

                          Then the MXP will copy the action file to presets/action folder automatically.

                          If you want know all the destination variable name, you can open file <Adobe Photoshop CS4>/configuration/XManConfig.xml

                          • 11. Re: Including Action
                            zhpingw Level 2
                            You can open panel.mxi file and modify it like these:

                            <files>
                            <file source="content" destination="$panels/TestColorPicker/" />
                            <file source="myaction.atn" destination="$actions"/>
                            </files>

                            Then the MXP will copy the action file to presets/action folder automatically.

                            If you want know all the destination variable name, you can open file <Adobe Photoshop CS4>/configuration/XManConfig.xml

                            • 12. Re: Including Action
                              myagmarbat
                              quote:

                              Originally posted by: leuallen
                              When making an .mxp file to share, the actions that I call for are not included with the package. Thus the panel does not work for the user who installs the .mxp file. Originally the action files were located in my own folder.That did not work. Copied the required action files to Photoshop/Presets/Actions. Built everything anew. Did not work. Copied action files to Panel/mypanel/content. Repeat - did not work.

                              Do I have to include a copy of my actions with the .mxp file and have the user install them? That does not sound right. How do I get my actions to be included with the .mxp file so that they are installed on the users machine?

                              Larry


                              • 13. Re: Including Action
                                myagmarbat Level 1
                                asdf
                                • 14. Including Action
                                  myagmarbat Level 1
                                  reply

                                  quote:

                                  Originally posted by: leuallen
                                  When making an .mxp file to share, the actions that I call for are not included with the package. Thus the panel does not work for the user who installs the .mxp file. Originally the action files were located in my own folder.That did not work. Copied the required action files to Photoshop/Presets/Actions. Built everything anew. Did not work. Copied action files to Panel/mypanel/content. Repeat - did not work.

                                  Do I have to include a copy of my actions with the .mxp file and have the user install them? That does not sound right. How do I get my actions to be included with the .mxp file so that they are installed on the users machine?

                                  Larry


                                  • 15. Re: Including Action
                                    Jeffrey Tranberry Adobe Employee
                                    Here's how I handle actions I want to share from Configurator:

                                    1) Save the action inside the 'contents' folder of an exported panel from Configurator (that way you don't need to modify the MXI file for the ExtensionManager installer
                                    2) instead of using the "Run Photoshop Action" object in Configurator, use the "Run JavaScript" object and use JavaScript to see if the action is loaded. If it's not, open it from inside "contents" folder and run it. The code looks something like this (make sure you take out the comments before you use the code in Configurator):

                                    ///////////////////////////
                                    //SET-UP /USER VARIABLES
                                    ///////////////////////////

                                    //Localized path to the Plug-Ins folder
                                    var strPlugInsFolderDirectory = localize( "$$$/LocalizedFilenames.xml/SourceDirectoryName/id/Extras/[LOCALE]/[LOCALE]_Plug-ins/valu e=Plug-ins" );

                                    //The Path to the action you want to install
                                    var actionFile = File(app.path.toString() + "/" + strPlugInsFolderDirectory + "/Panels/PanosFX/content/The%20BnBig%20picture.atn" );

                                    //The Action Set Name
                                    var actionSet = "The BnBig picture";

                                    //The Action Name
                                    var action = "THE ACTION";

                                    ///////////////////////////
                                    // FUNCTIONS
                                    ///////////////////////////

                                    var actionLoaded = false;// Set actionLoaded to false until we find a match

                                    // Functions to get the list of action sets currently installed
                                    cTID = function( s ) { return app.charIDToTypeID( s ); };

                                    getActionSets = function() {
                                    var i = 1;
                                    var sets = [ ];
                                    while ( true ) {
                                    var ref = new ActionReference();
                                    ref.putIndex( cTID( "ASet" ), i );
                                    var desc;
                                    var lvl = $.level;
                                    $.level = 0;
                                    try {
                                    desc = executeActionGet( ref );
                                    } catch ( e ) {
                                    break; // all done
                                    } finally {
                                    $.level = lvl;
                                    }
                                    if ( desc.hasKey( cTID( "Nm " ) ) ) {
                                    var set = { };
                                    set.index = i;
                                    set.name = desc.getString( cTID( "Nm " ) );
                                    set.toString = function( ) { return this.name; };
                                    set.count = desc.getInteger( cTID( "NmbC" ) );
                                    set.actions = [ ];
                                    for ( var j = 1; j <= set.count; j++ ) {
                                    var ref = new ActionReference( );
                                    ref.putIndex( cTID( 'Actn' ), j );
                                    ref.putIndex( cTID( 'ASet' ), set.index );
                                    var adesc = executeActionGet( ref );
                                    var actName = adesc.getString( cTID( 'Nm ' ) );
                                    set.actions.push( actName );
                                    }
                                    sets.push( set );
                                    }
                                    i++;
                                    }
                                    return sets;
                                    };

                                    var sets = getActionSets( );// get users actions sets

                                    // walk through the layer sets
                                    for (i=0; i<sets.length; i+=1) {
                                    if(sets == actionSet){
                                    //If we find a match set it to true
                                    actionLoaded = true;
                                    } //If not, then actionLoaded remains false
                                    }

                                    if(actionLoaded == true){ // if the action is loaded....
                                    try{
                                    // ...then run the action
                                    doAction(action, actionSet);
                                    }catch(e){
                                    //catch user cancellations. We don't want an error in Photoshop for the user stopping the action from one of the action Stop commands
                                    }
                                    }else{ // Otherwise the action isn't loaded
                                    try{
                                    // ...so load the action...
                                    open( actionFile );
                                    }catch(e){
                                    // Photoshop complains that the open options are invalid
                                    }
                                    try{
                                    // ...then play it.
                                    doAction(action, actionSet);
                                    }catch(e){
                                    //catch user cancellations. We don't want an error in Photoshop for the user stopping the action from one of the action Stop commands
                                    }
                                    }

                                    • 16. Re: Including Action
                                      seandyroff

                                      Hmm, I haven't been able to get this script to work. The problem is on line 29 when setting up the variable ref with

                                       

                                      var ref = new ActionReference();

                                       

                                      I keep getting the error that ActionReference doesn't have a constructor. Any suggestions?

                                      • 17. Re: Including Action
                                        Jeffrey Tranberry Adobe Employee

                                        Try the attached script.

                                        • 18. Re: Including Action
                                          Jeffrey Tranberry Adobe Employee

                                          /* SETUP */

                                           

                                          /* Localized path to the Plug-Ins folder */

                                          var strPlugInsFolderDirectory = localize( "$$$/LocalizedFilenames.xml/SourceDirectoryName/id/Extras/[LOCALE]/[LOCALE]_Plug-ins/valu e=Plug-ins" );

                                           

                                          /* The Path to the action you want to install */

                                          var actionFile = File(app.path.toString() + "/"  + strPlugInsFolderDirectory + "/Panels/PanosFX/content/The%20BnBig%20picture.atn" );

                                           

                                          /* The Action Set Name */

                                          var actionSet =  "The BnBig picture";

                                           

                                          /* The Action Name */

                                          var action =  "THE ACTION";

                                           

                                          var actionLoaded = false; /*  Set actionLoaded to false until we find a match */

                                           

                                          /* MAIN */

                                           

                                          /* Functions to get the list of action sets currently installed */

                                          cTID = function( s ) { return app.charIDToTypeID( s ); };

                                           

                                          /* getActionSets written by Mike Hale

                                          http://www.ps-scripts.com/bb/viewtopic.php?t=2463&highlight=getactionsets */

                                          getActionSets = function() {

                                            var i = 1;

                                            var sets = [ ];

                                            while ( true ) {

                                              var ref = new ActionReference();

                                              ref.putIndex( cTID( "ASet" ), i );

                                              var desc;

                                              var lvl = $.level;

                                              $.level = 0;

                                              try {

                                                desc = executeActionGet( ref );

                                              } catch ( e ) {

                                                break;    /* all done */

                                              } finally {

                                                $.level = lvl;

                                              }

                                              if ( desc.hasKey( cTID( "Nm  " ) ) ) {

                                                var set = { };

                                                set.index = i;

                                                set.name = desc.getString( cTID( "Nm  " ) );

                                                set.toString = function( ) { return this.name; };

                                                set.count = desc.getInteger( cTID( "NmbC" ) );

                                                set.actions = [ ];

                                                for ( var j = 1; j <= set.count; j++ ) {

                                                  var ref = new ActionReference( );

                                                  ref.putIndex( cTID( 'Actn' ), j );

                                                  ref.putIndex( cTID( 'ASet' ), set.index );

                                                  var adesc = executeActionGet( ref );

                                                  var actName = adesc.getString( cTID( 'Nm  ' ) );

                                                  set.actions.push( actName );

                                                }

                                                sets.push( set );

                                              }

                                              i++;

                                            }

                                            return sets;

                                          };

                                           

                                          var sets = getActionSets( );/* get users actions sets */

                                           

                                          /* walk through the layer sets */

                                          for (i=0; i<sets.length; i++) {

                                          if(sets[i] == actionSet){

                                          /* If we find a match set it to true */

                                          actionLoaded = true;

                                          } /* If not, then actionLoaded remains false */

                                          }

                                           

                                          if (!actionLoaded) { /* if the action is not loaded.... OR if (actionLoaded == false) */

                                          try{

                                          /* ...load the action... */

                                          load(actionFile);

                                          /* ...then play it. */

                                          doAction(action, actionSet);

                                          }catch(e){

                                          /* catch user cancellations. We don't want an error in Photoshop for the user stopping the action from one of the action Stop commands */

                                          }

                                          }else{ /* Otherwise the action is loaded */

                                          try{

                                          /* ...then play it. */

                                          doAction(action, actionSet);

                                          }catch(e){

                                          /* catch user cancellations. We don't want an error in Photoshop for the user stopping the action from one of the action Stop commands */   

                                          }

                                          }

                                          • 19. Re: Including Action
                                            Jeremy Knudsen Level 1

                                            I've started a new thread, asking a similar quesiton: Is there a similar way to include a style (*.asl) file?

                                            • 20. Re: Including Action
                                              Jeremy Knudsen Level 1

                                              This is a better Folder to use so that you can actually distribute your ZXP:

                                              var assetsFolder = new Folder(assetsPath);

                                               

                                              See: http://forums.adobe.com/thread/1016919