3 Replies Latest reply on Sep 22, 2010 6:14 AM by flexprinter

    How to access (read) plugin parameters using Javascript ?

    flexprinter

      I would like to access to the parameters value of a plugin written by myself using Javascript.

       

      For example, in the sample code of Photoshop SDK you can find the "Dissolve" plugin which contains a 'keyAmount' key of type 'unitPercent'.

       

      To call the plugin from Javascript you need to write something as:

       

      var idtwoFthreefivesixsixsixeighttwoFDBfournineAAAeightsixoneeighttwozerothreeDfiveAFthreethr eeeightC = stringIDToTypeID( "2F356668-2FDB-49AA-A861-8203D5AF338C" );

          var desc4 = new ActionDescriptor();

          var idAmnt = charIDToTypeID( "Amnt" );

          var idPrc = charIDToTypeID( "#Prc" );

          desc4.putUnitDouble( idAmnt, idPrc, 12.000000 );

          var iddisP = charIDToTypeID( "disP" );

          var idmooD = charIDToTypeID( "mooD" );

          var idmoDone = charIDToTypeID( "moD1" );

          desc4.putEnumerated( iddisP, idmooD, idmoDone );

      executeAction( idtwoFthreefivesixsixsixeighttwoFDBfournineAAAeightsixoneeighttwozerothreeDfiveAFthreethr eeeightC, desc4, DialogModes.NO );

       

      But my question is: It is possible to get the current value of 'Amnt' stored in this plugin using Javascript?

       

      Thank you in advance for your time.

       

      Angel.

        • 1. Re: How to access (read) plugin parameters using Javascript ?
          Michael L Hale Level 5

          As I understand it unless the script/plug-in has saved the last used setting in customOptions or some type of settings file the only time it will be able to get the last used settings is if it is being called from an action. In that case the settings will be in the app.playbackParameters.

          1 person found this helpful
          • 2. Re: How to access (read) plugin parameters using Javascript ?
            flexprinter Level 1

            Thank you Michael,

             

            I'll try to see if I can use app.playbackParameters to do what I need.

             

            My main problem is that I have a plugin that after being called from Javascript, make some calculations.

            The result is a string.

            I know how to call my plugin from Javascript, sending the needed parameters, but I do not know how to communicate my plugin and Javascript to retrieve the final result.

             

            I suspect that I need to use executeActionGet(), but I do not understand very well how ActionReference and ActionDescriptor are working and the final code doesn't work.

             

            If finally I'm not able to implement it, I can use a file to interchange the data, but I would prefer not to.

             

            Best regards,

            Angel.

            • 3. Re: How to access (read) plugin parameters using Javascript ?
              flexprinter Level 1

              Hi,

               

              Finally I have found a way to solve it using the descriptor that is returned after executing the plugin.

              So if you have something as:

               

               

              var pluginID = stringIDToTypeID( "2F356668-2FDB-49AA-A861-8203D5AF338C" );

                  var desc4 = new ActionDescriptor();

                  var idAmnt = charIDToTypeID( "Amnt" );

                  var idPrc = charIDToTypeID( "#Prc" );

                  desc4.putUnitDouble( idAmnt, idPrc, 12.000000 );

                  var iddisP = charIDToTypeID( "disP" );

                  var idmooD = charIDToTypeID( "mooD" );

                  var idmoDone = charIDToTypeID( "moD1" );

                  desc4.putEnumerated( iddisP, idmooD, idmoDone );

               

                   var retDesc = executeAction( pluginID, desc4, DialogModes.NO );

                   // If some value (e.g: "Amnt") is modified in the plugin, in retDec you have the new value.

                   // To extract it:

               

                   var newValue= retDesc.getDouble(idAmnt);

               

               

              Thank you again and regards,

               

              Angel.