Skip to content

Instantly share code, notes, and snippets.

@lm913
Created January 7, 2016 02:16
Show Gist options
  • Save lm913/a87db8bea34c2f575cec to your computer and use it in GitHub Desktop.
Save lm913/a87db8bea34c2f575cec to your computer and use it in GitHub Desktop.
// enable double clicking
#target photoshop
app.bringToFront();
var doc = activeDocument;
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits;
var startTypeUnits = app.preferences.typeUnits;
var startDisplayDialogs = app.displayDialogs;
// Set Adobe Photoshop CC 2015 to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
app.displayDialogs = DialogModes.NO;
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
var desc3 = new ActionDescriptor();
var desc4 = new ActionDescriptor();
var ref1 = new ActionReference();
var ref2 = new ActionReference();
var list1 = new ActionList();
var list2 = new ActionList();
var a = 0;
var hzn = 0;
var vrt = [ 0.000,
0.276,
43.007,
86.053,
125.347,
166.026,
218.864,
255.000];
ref1.putClass(cTID("AdjL"));
desc1.putReference(cTID("null"), ref1);
desc3.putEnumerated(sTID("presetKind"), sTID("presetKindType"), sTID("presetKindCustom"));
ref2.putEnumerated(cTID("Chnl"), cTID("Chnl"), cTID("Lght"));
desc4.putReference(cTID("Chnl"), ref2);
for (i = 1; i < vrt.length; i++) {
var descN = new ActionDescriptor();
a++;
descN.putDouble(cTID("Hrzn"), hzn); //from
descN.putDouble(cTID("Vrtc"), vrt[a]); //to
list2.putObject(cTID("Pnt "), descN);
hzn = hzn + (100 / 6) * 2.55;
}
desc4.putList(cTID("Crv "), list2);
list1.putObject(cTID("CrvA"), desc4);
desc3.putList(cTID("Adjs"), list1);
desc2.putObject(cTID("Type"), cTID("Crvs"), desc3);
desc1.putObject(cTID("Usng"), cTID("AdjL"), desc2);
executeAction(cTID("Mk "), desc1, DialogModes.NO);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment