I made this script the other day using script listening.
I use applescript for some of the info that I change, this worked fine. but now when I got to use it no gradient is applied?
Going through the code I noticed that it was asking for the preset Custom so I changed this to the settings I had. but still nothing.
Is there a way I can specify in the code how I want my gradient to look rather than call upon a gradient preset?
Its very temporental as, as I am using it , it now appears to work again.
Code: Select alltell application id "com.adobe.Photoshop"
activate
set ruler units of settings to pixel units
tell current document
set {height:originalHeight, width:originalWidth, resolution:OriginalReso} to it
set LowerMarquee to ((2 * originalHeight) / 1.6125) as integer
set current layer to layer "Main Image"
deselect
duplicate layer "Main Image"
scale current layer horizontal scale 100 vertical scale -100 anchor position bottom center
reveal all
--create layer mask
do javascript "var idMk = charIDToTypeID( 'Mk ' );
var desc10 = new ActionDescriptor();
var idNw = charIDToTypeID( 'Nw ' );
var idChnl = charIDToTypeID( 'Chnl' );
desc10.putClass( idNw, idChnl );
var idAt = charIDToTypeID( 'At ' );
var ref7 = new ActionReference();
var idChnl = charIDToTypeID( 'Chnl' );
var idChnl = charIDToTypeID( 'Chnl' );
var idMsk = charIDToTypeID( 'Msk ' );
ref7.putEnumerated( idChnl, idChnl, idMsk );
desc10.putReference( idAt, ref7 );
var idUsng = charIDToTypeID( 'Usng' );
var idUsrM = charIDToTypeID( 'UsrM' );
var idRvlA = charIDToTypeID( 'RvlA' );
desc10.putEnumerated( idUsng, idUsrM, idRvlA );
executeAction( idMk, desc10, DialogModes.NO );"
--make gradient
do javascript "var idGrdn = charIDToTypeID( 'Grdn' );
var desc14 = new ActionDescriptor();
var idFrom = charIDToTypeID( 'From' );
var desc15 = new ActionDescriptor();
var idHrzn = charIDToTypeID( 'Hrzn' );
var idPxl = charIDToTypeID( '#Pxl' );
desc15.putUnitDouble( idHrzn, idPxl, 0 );//line in width
var idVrtc = charIDToTypeID( 'Vrtc' );
var idPxl = charIDToTypeID( '#Pxl' );
desc15.putUnitDouble( idVrtc, idPxl, " & (2 * originalHeight) & " );
var idPnt = charIDToTypeID( 'Pnt ' );
desc14.putObject( idFrom, idPnt, desc15 );
var idT = charIDToTypeID( 'T ' );
var desc16 = new ActionDescriptor();
var idHrzn = charIDToTypeID( 'Hrzn' );
var idPxl = charIDToTypeID( '#Pxl' );
desc16.putUnitDouble( idHrzn, idPxl, 0 );//line width
var idVrtc = charIDToTypeID( 'Vrtc' );
var idPxl = charIDToTypeID( '#Pxl' );
desc16.putUnitDouble( idVrtc, idPxl, " & originalHeight & " );
var idPnt = charIDToTypeID( 'Pnt ' );
desc14.putObject( idT, idPnt, desc16 );
var idOpct = charIDToTypeID( 'Opct' );
var idPrc = charIDToTypeID( '#Prc' );
desc14.putUnitDouble( idOpct, idPrc, 100.000000 );
var idType = charIDToTypeID( 'Type' );
var idGrdT = charIDToTypeID( 'GrdT' );
var idLnr = charIDToTypeID( 'Lnr ' );
desc14.putEnumerated( idType, idGrdT, idLnr );
var idDthr = charIDToTypeID( 'Dthr' );
desc14.putBoolean( idDthr, true );
var idUsMs = charIDToTypeID( 'UsMs' );
desc14.putBoolean( idUsMs, true );
var idGrad = charIDToTypeID( 'Grad' );
var desc17 = new ActionDescriptor();
var idNm = charIDToTypeID( 'Nm ' );
desc17.putString( idNm, '''custom''' );
var idGrdF = charIDToTypeID( 'GrdF' );
var idGrdF = charIDToTypeID( 'GrdF' );
var idCstS = charIDToTypeID( 'CstS' );
desc17.putEnumerated( idGrdF, idGrdF, idCstS );
var idIntr = charIDToTypeID( 'Intr' );
desc17.putDouble( idIntr, 4096.000000 );
var idClrs = charIDToTypeID( 'Clrs' );
var list1 = new ActionList();
var desc18 = new ActionDescriptor();
var idType = charIDToTypeID( 'Type' );
var idClry = charIDToTypeID( 'Clry' );
var idFrgC = charIDToTypeID( 'FrgC' );
desc18.putEnumerated( idType, idClry, idFrgC );
var idLctn = charIDToTypeID( 'Lctn' );
desc18.putInteger( idLctn, 0 );
var idMdpn = charIDToTypeID( 'Mdpn' );
desc18.putInteger( idMdpn, 50 );
var idClrt = charIDToTypeID( 'Clrt' );
list1.putObject( idClrt, desc18 );
var desc19 = new ActionDescriptor();
var idType = charIDToTypeID( 'Type' );
var idClry = charIDToTypeID( 'Clry' );
var idFrgC = charIDToTypeID( 'FrgC' );
desc19.putEnumerated( idType, idClry, idFrgC );
var idLctn = charIDToTypeID( 'Lctn' );
desc19.putInteger( idLctn, 4096 );
var idMdpn = charIDToTypeID( 'Mdpn' );
desc19.putInteger( idMdpn, 50 );
var idClrt = charIDToTypeID( 'Clrt' );
list1.putObject( idClrt, desc19 );
desc17.putList( idClrs, list1 );
var idTrns = charIDToTypeID( 'Trns' );
var list2 = new ActionList();
var desc20 = new ActionDescriptor();
var idOpct = charIDToTypeID( 'Opct' );
var idPrc = charIDToTypeID( '#Prc' );
desc20.putUnitDouble( idOpct, idPrc, 100.000000 );
var idLctn = charIDToTypeID( 'Lctn' );
desc20.putInteger( idLctn, 3600 );
var idMdpn = charIDToTypeID( 'Mdpn' );
desc20.putInteger( idMdpn, 50 );
var idTrnS = charIDToTypeID( 'TrnS' );
list2.putObject( idTrnS, desc20 );
var desc21 = new ActionDescriptor();
var idOpct = charIDToTypeID( 'Opct' );
var idPrc = charIDToTypeID( '#Prc' );
desc21.putUnitDouble( idOpct, idPrc, 40 );
var idLctn = charIDToTypeID( 'Lctn' );
desc21.putInteger( idLctn, 4075 );
var idMdpn = charIDToTypeID( 'Mdpn' );
desc21.putInteger( idMdpn, 50 );
var idTrnS = charIDToTypeID( 'TrnS' );
list2.putObject( idTrnS, desc21 );
desc17.putList( idTrns, list2 );
var idGrdn = charIDToTypeID( 'Grdn' );
desc14.putObject( idGrad, idGrdn, desc17 );
executeAction( idGrdn, desc14, DialogModes.NO );"
--apply layer
Create a gradient without using a preset?
Create a gradient without using a preset?
I have used the gradient in combination with shape layers, but it should be the same for any gradient. I use the scriptlistener to record applying a gradient. I don't use the presets, but set the values to something I can recognize. Then I go in and change those values to a variable that I change with the script. I'm mainly taking an image, sampling the color in various spots then applying those colors to shape layers as a gradient as shown in the image at this link: https://plus.google.com/u/0/photos/1037 ... 1376454833 ... 1376454833
Create a gradient without using a preset?
I actually did exactly as you said, to select some points that you can recognise, but within that script I still have this line
desc17.putString( idNm, '''Custom''' );
Where it is using a preset.
desc17.putString( idNm, '''Custom''' );
Where it is using a preset.