2 Replies Latest reply on Mar 2, 2018 2:46 PM by Naoki-Hada

    Help: Change Feather value on Photoshop UI (menu bar)

    Naoki-Hada Level 1

      Hi all,

       

      I'm trying to control Photoshop UI's Feather value on menu bar from script at following place.
      I mean changing UI value and not doing "document.selection.feather(123)".

      20180302_Ps_Featehr.png

      I followed the code from following:

      [Q] Brush's spacing setting for get/set or ignore.

       

      Following is current code and not wokring and causing error.

       

      function setFeather(value) {
           var ar = new ActionReference();
           ar.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "tool" ) );
           ar.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
      
           var ret = executeActionGet(ar);
      
           var tmp = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));
      
           var ad = new ActionDescriptor();
           ad.putReference( charIDToTypeID( "null" ), ar );
      
           if (value != undefined) tmp.putUnitDouble( charIDToTypeID( "MrqF" ), charIDToTypeID( "#Pxl" ), value );  // Double, Pixel
           ad.putObject( charIDToTypeID( "T   " ), charIDToTypeID( "Ordn" ), tmp ); // Testing: NG
      
           executeAction( charIDToTypeID( "setd" ), ad, DialogModes.NO );
      }
      
      setFeather(456);
      

       

      Error from ESTK

       

      capture_20180302_113431.png

       

      And data structure dump around Feather part from Getter Demo script (from Xtools) is following.

      Line #13 is Feather.

       

        <Object symname="CurrentToolOptions" sym="CrnT" objectTypeString="CurrentToolOptions" objectType="CrnT" count="5">
          <Boolean symname="Contiguous" sym="Cntg" boolean="true"/>
          <Integer symname="Selection" sym="Slct" integer="0"/>
          <Object symname="MrqI" sym="MrqI" objectTypeString="MrqC" objectType="MrqC" count="7">
            <Integer symname="MrqM" sym="MrqM" integer="1"/>
            <Integer symname="AspV" sym="AspV" integer="1000"/>
            <Integer symname="AspH" sym="AspH" integer="1000"/>
            <Double symname="FxdW" sym="FxdW" double="64"/>
            <Double symname="FxdH" sym="FxdH" double="64"/>
            <Integer symname="FxWU" sym="FxWU" integer="0"/>
            <Integer symname="FxHU" sym="FxHU" integer="0"/>
          </Object>
          <UnitDouble symname="MrqF" sym="MrqF" unitDoubleTypeString="Pixels" unitDoubleType="#Pxl" unitDoubleValue="123"/>
          <Boolean symname="MrqA" sym="MrqA" boolean="true"/>
        </Object>
      

       

      Above is different from Brush structure as following for above other thread code.

      https://forums.adobe.com/message/9971030

       

        <Object symname="CurrentToolOptions" sym="CrnT" objectTypeString="CurrentToolOptions" objectType="CrnT" count="59">
          <Integer symname="flow" sym="flow" integer="100"/>
          <Integer symname="Smooth" sym="Smoo" integer="7"/>
          <Object symname="prVr" sym="prVr" objectTypeString="brVr" objectType="brVr" count="4">
            <Integer symname="bVTy" sym="bVTy" integer="0"/>
            <Integer symname="fStp" sym="fStp" integer="25"/>
            <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
            <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          </Object>
          <Object symname="opVr" sym="opVr" objectTypeString="brVr" objectType="brVr" count="4">
            <Integer symname="bVTy" sym="bVTy" integer="0"/>
            <Integer symname="fStp" sym="fStp" integer="25"/>
            <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
            <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          </Object>
          <Enumerated symname="Mode" sym="Md  " enumeratedTypeString="BlendMode" enumeratedType="BlnM" enumeratedValueString="Normal" enumeratedValue="Nrml"/>
          <Integer symname="Opacity" sym="Opct" integer="39"/>
          <Object symname="Brushes" sym="Brsh" objectTypeString="computedBrush" objectType="computedBrush" count="8">
            <UnitDouble symname="Diameter" sym="Dmtr" unitDoubleTypeString="Pixels" unitDoubleType="#Pxl" unitDoubleValue="133"/>
            <UnitDouble symname="Hardness" sym="Hrdn" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
            <UnitDouble symname="Angle" sym="Angl" unitDoubleTypeString="Angle" unitDoubleType="#Ang" unitDoubleValue="0"/>
            <UnitDouble symname="Roundness" sym="Rndn" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="100"/>
            <UnitDouble symname="Spacing" sym="Spcn" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="25"/>
            <Boolean symname="Interpolation" sym="Intr" boolean="true"/>
            <Boolean symname="flipX" sym="flipX" boolean="false"/>
            <Boolean symname="flipY" sym="flipY" boolean="false"/>
          </Object>
          <Boolean symname="useTipDynamics" sym="useTipDynamics" boolean="true"/>
          <Boolean symname="flipX" sym="flipX" boolean="false"/>
          <Boolean symname="flipY" sym="flipY" boolean="false"/>
          <Boolean symname="brushProjection" sym="brushProjection" boolean="false"/>
          <UnitDouble symname="minimumDiameter" sym="minimumDiameter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="63"/>
          <UnitDouble symname="minimumRoundness" sym="minimumRoundness" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="25"/>
          <UnitDouble symname="tiltScale" sym="tiltScale" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="200"/>
          <Object symname="szVr" sym="szVr" objectTypeString="brVr" objectType="brVr" count="4">
            <Integer symname="bVTy" sym="bVTy" integer="0"/>
            <Integer symname="fStp" sym="fStp" integer="25"/>
            <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="34"/>
            <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          </Object>
          <Object symname="angleDynamics" sym="angleDynamics" objectTypeString="brVr" objectType="brVr" count="4">
            <Integer symname="bVTy" sym="bVTy" integer="0"/>
            <Integer symname="fStp" sym="fStp" integer="25"/>
            <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="43"/>
            <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          </Object>
          <Object symname="roundnessDynamics" sym="roundnessDynamics" objectTypeString="brVr" objectType="brVr" count="4">
            <Integer symname="bVTy" sym="bVTy" integer="0"/>
            <Integer symname="fStp" sym="fStp" integer="25"/>
            <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="36"/>
            <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          </Object>
          <Boolean symname="useScatter" sym="useScatter" boolean="true"/>
          <Double symname="Count" sym="Cnt " double="1"/>
          <Boolean symname="bothAxes" sym="bothAxes" boolean="false"/>
          <Object symname="countDynamics" sym="countDynamics" objectTypeString="brVr" objectType="brVr" count="4">
            <Integer symname="bVTy" sym="bVTy" integer="0"/>
            <Integer symname="fStp" sym="fStp" integer="25"/>
            <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
            <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          </Object>
          <Object symname="scatterDynamics" sym="scatterDynamics" objectTypeString="brVr" objectType="brVr" count="4">
            <Integer symname="bVTy" sym="bVTy" integer="0"/>
            <Integer symname="fStp" sym="fStp" integer="25"/>
            <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="30"/>
            <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          </Object>
          <Object symname="Texture" sym="Txtr" objectTypeString="Pattern" objectType="Ptrn" count="2">
            <String symname="Name" sym="Nm  " string="$$$/Presets/Patterns/Watercolor=Watercolor"/>
            <String symname="ID" sym="Idnt" string="c7b13f16-e1aa-11d5-913f-bc81e4dfd608"/>
          </Object>
          <UnitDouble symname="textureScale" sym="textureScale" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="100"/>
          <Boolean symname="InvertTexture" sym="InvT" boolean="false"/>
          <Boolean symname="protectTexture" sym="protectTexture" boolean="false"/>
          <Integer symname="textureBrightness" sym="textureBrightness" integer="0"/>
          <Integer symname="textureContrast" sym="textureContrast" integer="0"/>
          <Boolean symname="useTexture" sym="useTexture" boolean="true"/>
          <Boolean symname="TextureCoverage" sym="TxtC" boolean="true"/>
          <Boolean symname="interpretation" sym="interpretation" boolean="true"/>
          <Enumerated symname="textureBlendMode" sym="textureBlendMode" enumeratedTypeString="BlendMode" enumeratedType="BlnM" enumeratedValueString="Height" enumeratedValue="Hght"/>
          <UnitDouble symname="textureDepth" sym="textureDepth" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="100"/>
          <UnitDouble symname="minimumDepth" sym="minimumDepth" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          <Object symname="textureDepthDynamics" sym="textureDepthDynamics" objectTypeString="brVr" objectType="brVr" count="4">
            <Integer symname="bVTy" sym="bVTy" integer="0"/>
            <Integer symname="fStp" sym="fStp" integer="25"/>
            <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
            <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          </Object>
          <Object symname="dualBrush" sym="dualBrush" objectTypeString="dualBrush" objectType="dualBrush" count="9">
            <Boolean symname="useDualBrush" sym="useDualBrush" boolean="true"/>
            <Boolean symname="Flip" sym="Flip" boolean="false"/>
            <Object symname="Brushes" sym="Brsh" objectTypeString="computedBrush" objectType="computedBrush" count="8">
              <UnitDouble symname="Diameter" sym="Dmtr" unitDoubleTypeString="Pixels" unitDoubleType="#Pxl" unitDoubleValue="5000"/>
              <UnitDouble symname="Hardness" sym="Hrdn" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
              <UnitDouble symname="Angle" sym="Angl" unitDoubleTypeString="Angle" unitDoubleType="#Ang" unitDoubleValue="0"/>
              <UnitDouble symname="Roundness" sym="Rndn" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="100"/>
              <UnitDouble symname="Spacing" sym="Spcn" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="25"/>
              <Boolean symname="Interpolation" sym="Intr" boolean="true"/>
              <Boolean symname="flipX" sym="flipX" boolean="false"/>
              <Boolean symname="flipY" sym="flipY" boolean="false"/>
            </Object>
            <Enumerated symname="BlendMode" sym="BlnM" enumeratedTypeString="BlendMode" enumeratedType="BlnM" enumeratedValueString="ColorBurn" enumeratedValue="CBrn"/>
            <Boolean symname="useScatter" sym="useScatter" boolean="true"/>
            <Double symname="Count" sym="Cnt " double="1"/>
            <Boolean symname="bothAxes" sym="bothAxes" boolean="false"/>
            <Object symname="countDynamics" sym="countDynamics" objectTypeString="brVr" objectType="brVr" count="4">
              <Integer symname="bVTy" sym="bVTy" integer="0"/>
              <Integer symname="fStp" sym="fStp" integer="25"/>
              <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
              <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
            </Object>
            <Object symname="scatterDynamics" sym="scatterDynamics" objectTypeString="brVr" objectType="brVr" count="4">
              <Integer symname="bVTy" sym="bVTy" integer="0"/>
              <Integer symname="fStp" sym="fStp" integer="25"/>
              <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
              <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
            </Object>
          </Object>
          <Boolean symname="useColorDynamics" sym="useColorDynamics" boolean="true"/>
          <Object symname="clVr" sym="clVr" objectTypeString="brVr" objectType="brVr" count="4">
            <Integer symname="bVTy" sym="bVTy" integer="0"/>
            <Integer symname="fStp" sym="fStp" integer="25"/>
            <UnitDouble symname="jitter" sym="jitter" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
            <UnitDouble symname="Minimum" sym="Mnm " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          </Object>
          <UnitDouble symname="Hue" sym="H   " unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          <UnitDouble symname="Start" sym="Strt" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          <UnitDouble symname="Brightness" sym="Brgh" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          <UnitDouble symname="purity" sym="purity" unitDoubleTypeString="Percent" unitDoubleType="#Prc" unitDoubleValue="0"/>
          <Boolean symname="colorDynamicsPerTip" sym="colorDynamicsPerTip" boolean="true"/>
          <Boolean symname="WetEdges" sym="Wtdg" boolean="false"/>
          <Boolean symname="Noise" sym="Nose" boolean="false"/>
          <Boolean symname="usePaintDynamics" sym="usePaintDynamics" boolean="true"/>
          <Boolean symname="useBrushPose" sym="useBrushPose" boolean="false"/>
          <Boolean symname="Repeat" sym="Rpt " boolean="true"/>
          <Boolean symname="smoothing" sym="smoothing" boolean="true"/>
          <Double symname="smoothingValue" sym="smoothingValue" double="18"/>
          <Boolean symname="smoothingRadiusMode" sym="smoothingRadiusMode" boolean="false"/>
          <Boolean symname="smoothingCatchup" sym="smoothingCatchup" boolean="true"/>
          <Boolean symname="smoothingCatchupAtEnd" sym="smoothingCatchupAtEnd" boolean="false"/>
          <Boolean symname="smoothingZoomCompensation" sym="smoothingZoomCompensation" boolean="true"/>
          <Boolean symname="pressureSmoothing" sym="pressureSmoothing" boolean="false"/>
          <Object symname="ForegroundColor" sym="FrgC" objectTypeString="RGBColor" objectType="RGBC" count="3">
            <Double symname="Red" sym="Rd  " double="0"/>
            <Double symname="Green" sym="Grn " double="0"/>
            <Double symname="Blue" sym="Bl  " double="0"/>
          </Object>
          <Boolean symname="usePressureOverridesSize" sym="usePressureOverridesSize" boolean="false"/>
          <Boolean symname="usePressureOverridesOpacity" sym="usePressureOverridesOpacity" boolean="false"/>
          <Boolean symname="useLegacy" sym="useLegacy" boolean="false"/>
        </Object>
      

       

      Any suggestion, tips are appriciated.

       

      Thank you very much,

      Naoki

        • 1. Re: Help: Change Feather value on Photoshop UI (menu bar)
          r-bin Level 5
          function setFeather(value) {  
                   var ar = new ActionReference();  
                   ar.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "tool" ) );  
                   ar.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );  
                
                   var ret = executeActionGet(ar);  
                
                   var tmp = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));  
          var tool = ret.getEnumerationType(stringIDToTypeID("tool")); //!!!!!!!!!!
                
                   var ad = new ActionDescriptor();  
                  
          ar = new ActionReference(); //!!!!!!!!!!
          ar.putClass( tool );        //!!!!!!!!!!
          
                   ad.putReference( charIDToTypeID( "null" ), ar );  
                
                   if (value != undefined) tmp.putUnitDouble( charIDToTypeID( "MrqF" ), charIDToTypeID( "#Pxl" ), value );  // Double, Pixel  
                   ad.putObject( charIDToTypeID( "T   " ), charIDToTypeID( "Ordn" ), tmp ); // Testing: NG  
                
                   executeAction( charIDToTypeID( "setd" ), ad, DialogModes.NO );  
              }  
                
          setFeather(456);  
          
          2 people found this helpful
          • 2. Re: Help: Change Feather value on Photoshop UI (menu bar)
            Naoki-Hada Level 1

            r-bin

            Thank you very much again for the code.

            It worked perfectly.

             

            Just additional note for someone's help.

            "MrqF" is for Marquee tools.

            For Lasso tools, it needs to be replaced to "DrwR".

            # I got stuck here at verification.

             

            Thank you,

            Naoki