??? Le July 14, 2017 à 1:40:44 AM, c.pfaffenbichler (forums_noreply@adobe.com) a écrit: Utilize foreground/background colour in gradient fill c.pfaffenbichler marked pixxxel schubser's reply on Utilize foreground/background colour in gradient fill as helpful. View the full reply Marked as helpful: What c.pfaffenbichler means: Replace the color values in your code with the values for foreground an background colors eg like this // Make Gradient fill from Path if (activeDocument.mode == "DocumentMode.RGB") { var fgCol = app.foregroundColor.rgb; var bkCol = app.backgroundColor.rgb; (ref1 = new ActionReference()).putClass(stringIDToTypeID('contentLayer')); (desc1 = new ActionDescriptor()).putReference(charIDToTypeID('null'), ref1); (desc3 = new ActionDescriptor()).putUnitDouble(charIDToTypeID('Angl'), charIDToTypeID('#Ang'), 90) desc3.putEnumerated(charIDToTypeID('Type'), charIDToTypeID('GrdT'), charIDToTypeID('Lnr ')); (desc4 = new ActionDescriptor()).putString(charIDToTypeID('Nm '), '''$$$/DefaultGradient/ForegroundToBackground=Foreground to Background''') desc4.putEnumerated(charIDToTypeID('GrdF'), charIDToTypeID('GrdF'), charIDToTypeID('CstS')) desc4.putDouble(charIDToTypeID('Intr'), 4096); var desc6 = new ActionDescriptor(); desc6.putDouble(charIDToTypeID('Rd '), fgCol.red); desc6.putDouble(charIDToTypeID('Grn '), fgCol.green); desc6.putDouble(charIDToTypeID('Bl '), fgCol.blue); (desc5 = new ActionDescriptor()).putObject(charIDToTypeID('Clr '), charIDToTypeID('RGBC'), desc6) desc5.putEnumerated(charIDToTypeID('Type'), charIDToTypeID('Clry'), charIDToTypeID('UsrS')) desc5.putInteger(charIDToTypeID('Lctn'), 0) desc5.putInteger(charIDToTypeID('Mdpn'), 50); (list1 = new ActionList()).putObject(stringIDToTypeID('colorStop'), desc5); var desc8 = new ActionDescriptor(); desc8.putDouble(charIDToTypeID('Rd '), bkCol.red); desc8.putDouble(charIDToTypeID('Grn '), bkCol.green); desc8.putDouble(charIDToTypeID('Bl '), bkCol.blue); (desc7 = new ActionDescriptor()).putObject(charIDToTypeID('Clr '), charIDToTypeID('RGBC'), desc8) desc7.putEnumerated(charIDToTypeID('Type'), charIDToTypeID('Clry'), charIDToTypeID('UsrS')) desc7.putInteger(charIDToTypeID('Lctn'), 4096) desc7.putInteger(charIDToTypeID('Mdpn'), 50) list1.putObject(charIDToTypeID('Clrt'), desc7) desc4.putList(charIDToTypeID('Clrs'), list1); (desc9 = new ActionDescriptor()).putUnitDouble(charIDToTypeID('Opct'), charIDToTypeID('#Prc'), 100) desc9.putInteger(charIDToTypeID('Lctn'), 0) desc9.putInteger(charIDToTypeID('Mdpn'), 50); (list2 = new ActionList()).putObject(charIDToTypeID('TrnS'), desc9); (desc10 = new ActionDescriptor()).putUnitDouble(charIDToTypeID('Opct'), charIDToTypeID('#Prc'), 100) desc10.putInteger(charIDToTypeID('Lctn'), 4096) desc10.putInteger(charIDToTypeID('Mdpn'), 50) list2.putObject(charIDToTypeID('TrnS'), desc10) desc4.putList(charIDToTypeID('Trns'), list2) desc3.putObject(charIDToTypeID('Grad'), charIDToTypeID('Grdn'), desc4); (desc2 = new ActionDescriptor()).putObject(charIDToTypeID('Type'), stringIDToTypeID('gradientLayer'), desc3) desc1.putObject(charIDToTypeID('Usng'), stringIDToTypeID('contentLayer'), desc2) executeAction(charIDToTypeID('Mk '), desc1, DialogModes.NO); } Change the code part of your // Make Gradient fill from Path with the snippet above and Have fun Following Photoshop Scripting in these streams: Inbox This email was sent by Adobe Community because you are a registered user. You may unsubscribe instantly from Adobe Community, or adjust email frequency in your email preferences
... View more