-
1. Re: Resize a smart object by 'point'
Mattmcquiff Mar 14, 2014 2:27 AM (in response to Mattmcquiff)This is a script of the action
#target photoshop
//
// Sticker Placer.jsx
//
//
// Generated Fri Mar 14 2014 09:13:41 GMT-0000
//
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
//
//==================== Sticker Placer ==============
//
function Action7() {
// Image Size
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putUnitDouble(cTID('Wdth'), cTID('#Rlt'), 1020);
executeAction(sTID('imageSize'), desc1, dialogMode);
};
// Make
function step2(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID('Pstn'), cTID('#Rlt'), 27);
desc2.putEnumerated(cTID('Ornt'), cTID('Ornt'), cTID('Vrtc'));
desc1.putObject(cTID('Nw '), cTID('Gd '), desc2);
executeAction(cTID('Mk '), desc1, dialogMode);
};
// Make
function step3(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID('Pstn'), cTID('#Rlt'), 29);
desc2.putEnumerated(cTID('Ornt'), cTID('Ornt'), cTID('Hrzn'));
desc1.putObject(cTID('Nw '), cTID('Gd '), desc2);
executeAction(cTID('Mk '), desc1, dialogMode);
};
// Make
function step4(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID('Pstn'), cTID('#Rlt'), 280);
desc2.putEnumerated(cTID('Ornt'), cTID('Ornt'), cTID('Vrtc'));
desc1.putObject(cTID('Nw '), cTID('Gd '), desc2);
executeAction(cTID('Mk '), desc1, dialogMode);
};
// Make
function step5(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID('Pstn'), cTID('#Rlt'), 282);
desc2.putEnumerated(cTID('Ornt'), cTID('Ornt'), cTID('Hrzn'));
desc1.putObject(cTID('Nw '), cTID('Gd '), desc2);
executeAction(cTID('Mk '), desc1, dialogMode);
};
// Make
function step6(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putClass(cTID('Lyr '));
desc1.putReference(cTID('null'), ref1);
executeAction(cTID('Mk '), desc1, dialogMode);
};
// Set
function step7(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
desc1.putReference(cTID('null'), ref1);
var desc2 = new ActionDescriptor();
desc2.putString(cTID('Nm '), "Sticker");
desc1.putObject(cTID('T '), cTID('Lyr '), desc2);
executeAction(cTID('setd'), desc1, dialogMode);
};
// Set
function step8(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID('Chnl'), sTID("selection"));
desc1.putReference(cTID('null'), ref1);
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID('Top '), cTID('#Rlt'), 0);
desc2.putUnitDouble(cTID('Left'), cTID('#Rlt'), 0);
desc2.putUnitDouble(cTID('Btom'), cTID('#Rlt'), 324);
desc2.putUnitDouble(cTID('Rght'), cTID('#Rlt'), 326);
desc1.putObject(cTID('T '), cTID('Rctn'), desc2);
executeAction(cTID('setd'), desc1, dialogMode);
};
// Fill
function step9(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID('Hrzn'), cTID('#Rlt'), 0);
desc2.putUnitDouble(cTID('Vrtc'), cTID('#Rlt'), 0);
desc1.putObject(cTID('From'), cTID('Pnt '), desc2);
desc1.putInteger(cTID('Tlrn'), 32);
desc1.putEnumerated(cTID('Usng'), cTID('FlCn'), cTID('Ptrn'));
var desc3 = new ActionDescriptor();
desc3.putString(cTID('Nm '), "sticker.tif");
desc3.putString(cTID('Idnt'), "56e0a18a-eb55-1176-97d3-fe60e1fab27c");
desc1.putObject(cTID('Ptrn'), cTID('Ptrn'), desc3);
desc1.putBoolean(cTID('Cntg'), false);
executeAction(cTID('Fl '), desc1, dialogMode);
};
// Set
function step10(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID('Chnl'), sTID("selection"));
desc1.putReference(cTID('null'), ref1);
desc1.putEnumerated(cTID('T '), cTID('Ordn'), cTID('None'));
executeAction(cTID('setd'), desc1, dialogMode);
};
// Convert to Smart Object
function step11(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
executeAction(sTID('newPlacedLayer'), undefined, dialogMode);
};
// Transform
function step12(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putEnumerated(cTID('FTcs'), cTID('QCSt'), sTID("QCSCorner0"));
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID('Hrzn'), cTID('#Rlt'), 27);
desc2.putUnitDouble(cTID('Vrtc'), cTID('#Rlt'), 29);
desc1.putObject(cTID('Ofst'), cTID('Ofst'), desc2);
desc1.putUnitDouble(cTID('Wdth'), cTID('#Rlt'), 253);
desc1.putUnitDouble(cTID('Hght'), cTID('#Rlt'), 253);
executeAction(cTID('Trnf'), desc1, dialogMode);
};
step1(); // Image Size
step2(); // Make
step3(); // Make
step4(); // Make
step5(); // Make
step6(); // Make
step7(); // Set
step8(); // Set
step9(); // Fill
step10(); // Set
step11(); // Convert to Smart Object
step12(); // Transform
};
//=========================================
// Sticker PLacer.main
//=========================================
//
Action7.main = function () {
Action7();
};
Action7.main();
// EOF
"Action7.jsx"
// EOF
