2 Replies Latest reply on Mar 11, 2016 3:16 AM by gionnyp9672044

    recall script function

    gionnyp9672044

      I created a dialog panel with buttons

      these buttons all use a function in this case proposed and multiply

      since I am very script how do I call this function?

       

      this a try

       

       

       

      win.crealayer.scurBtn.onClick = function () {

       

       

      // =======================================================

      var idMk = charIDToTypeID( "Mk  " );

          var desc514 = new ActionDescriptor();

          var idnull = charIDToTypeID( "null" );

              var ref261 = new ActionReference();

              var idAdjL = charIDToTypeID( "AdjL" );

              ref261.putClass( idAdjL );

          desc514.putReference( idnull, ref261 );

          var idUsng = charIDToTypeID( "Usng" );

              var desc515 = new ActionDescriptor();

              var idType = charIDToTypeID( "Type" );

                  var desc516 = new ActionDescriptor();

                  var idpresetKind = stringIDToTypeID( "presetKind" );

                  var idpresetKindType = stringIDToTypeID( "presetKindType" );

                  var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );

                  desc516.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );

              var idCrvs = charIDToTypeID( "Crvs" );

              desc515.putObject( idType, idCrvs, desc516 );

          var idAdjL = charIDToTypeID( "AdjL" );

          desc514.putObject( idUsng, idAdjL, desc515 );

      executeAction( idMk, desc514, DialogModes.NO );

       

      app.doAction("FusionMultiply", "UserSteps");

      }

       

       

      function FusionMultiply()

      {

          var idLvls = charIDToTypeID( "Lvls" );

          var desc4 = new ActionDescriptor();

          var idpresetKind = stringIDToTypeID( "presetKind" );

          var idpresetKindType = stringIDToTypeID( "presetKindType" );

          var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );

          desc4.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );

          var idAdjs = charIDToTypeID( "Adjs" );

              var list3 = new ActionList();

                  var desc5 = new ActionDescriptor();

                  var idChnl = charIDToTypeID( "Chnl" );

                      var ref2 = new ActionReference();

                      var idChnl = charIDToTypeID( "Chnl" );

                      var idChnl = charIDToTypeID( "Chnl" );

                      var idCmps = charIDToTypeID( "Cmps" );

                      ref2.putEnumerated( idChnl, idChnl, idCmps );

                  desc5.putReference( idChnl, ref2 );

                  var idAuCo = charIDToTypeID( "AuCo" );

                  desc5.putBoolean( idAuCo, true );

                  var idBlcC = charIDToTypeID( "BlcC" );

                  desc5.putDouble( idBlcC, 0.000000 );

                  var idWhtC = charIDToTypeID( "WhtC" );

                  desc5.putDouble( idWhtC, 0.000000 );

              var idLvlA = charIDToTypeID( "LvlA" );

              list3.putObject( idLvlA, desc5 );

          desc4.putList( idAdjs, list3 );

          executeAction( idLvls, desc4, DialogModes.NO );

      }

        • 1. Re: recall script function
          Chuck Uebele Adobe Community Professional & MVP

          You have to put the onClick function within the code that defines your UI - just before the show() is good.

          The functions you have listed should be outside of the code that creates the UI. You refer to those functions within the onClick ui by just listed them:

           

          //code creating your UI
          win.crealayer.scurBtn.onClick = function () {
               FusionMultiply()
          }
          
          win.show()
          
          function FusionMultiply()
          {
          //code here for that function
          }
          

           

          That first big block of AM code should most likely be put in a separate function also and referred to as the example above.

          • 2. Re: recall script function
            gionnyp9672044 Level 1

            Chuck Uebele

            you are great

            thank you