Copy link to clipboard
Copied
Is that possible to create Shape in Marquee Tool ?
Step 1:- Select Marquee Tool
Step 2:- Automatic Create Shape in scripts How much want this shape
It's automatic making shape through Marquee tool... Thanks in Advance
1 Correct answer
Reviewing the print;
Maybe he tries to add four shapes within the selection divided by two columns and two rows. If it's green, I have an adaptation of a @Chuck Uebele script here...
#target photoshop;
app.bringToFront();
main()
function main(){
app.bringToFront();
var row = 2;
var column = 2;
var ldivision =10;
var corner = 5;
app.preferences.rulerUnits = Units.PIXELS; //new
if(app.documents.length>0){
var doc = activeDocument;
try{
var doc = ac
...
Explore related tutorials & articles
Copy link to clipboard
Copied
I want to Every Shape will be colorful for each shape different color
Copy link to clipboard
Copied
1. Use pre-defined array with RGB values
2. Use Math.random() * 255 for each color component
Copy link to clipboard
Copied
Can you share the script file
Copy link to clipboard
Copied
what exactly is your problem?
Copy link to clipboard
Copied
Thanku so much sir, Worked It.
Can I add Feather Section in Script:-
Where is add this script :-
app.activeDocument.selection.feather(new UnitValue(amt,"px"));
Copy link to clipboard
Copied
Thanks for the tip @jazz-y ! I believe that is enough.
#target photoshop;
app.bringToFront();
main()
function main(){
app.bringToFront();
var row = 6;
var column =6;
var ldivision =10;
var corner = 5;
app.preferences.rulerUnits = Units.PIXELS; //new
if(app.documents.length>0){
var doc = activeDocument;
try{
var doc = activeDocument;
var sBounds = doc.selection.bounds;
var lineAdjW = ldivision/row
var lineAdjH = ldivision/column
var sWidth = (parseFloat(sBounds[2]) -parseFloat(sBounds[0]))/column - ldivision + ldivision/(row ); //modified
var sHeight = (parseFloat(sBounds[3]) -parseFloat(sBounds[1]))/row - ldivision + ldivision/(column ) ; //modified
var leftSide = parseFloat (sBounds[0]);
var topSide = parseFloat (sBounds[1]);
for(var i=0;i<row;i++){
leftSide = parseFloat (sBounds[0]);
for(var j=0;j<column;j++){
Create_Rectangle (topSide, leftSide, topSide + sHeight, leftSide + sWidth, corner) //old code
leftSide += sWidth + ldivision
}
topSide += sHeight +ldivision
}
}
catch(e){}
}
else {alert("There is no open document!")}
function Create_Rectangle(t,l,b,r, corner) {
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putClass(sTID("contentLayer"));
desc1.putReference(cTID("null"), ref1);
var desc2 = new ActionDescriptor();
var desc3 = new ActionDescriptor();
var desc4 = new ActionDescriptor();
desc4.putDouble(cTID("Rd "), Math.random() * 255);
desc4.putDouble(cTID("Grn "), Math.random() * 255);
desc4.putDouble(cTID("Bl "), Math.random() * 255);
desc3.putObject(cTID("Clr "), sTID("RGBColor"), desc4);
desc2.putObject(cTID("Type"), sTID("solidColorLayer"), desc3);
var desc5 = new ActionDescriptor();
desc5.putInteger(sTID("unitValueQuadVersion"), 1);
desc5.putUnitDouble(cTID("Top "), cTID("#Pxl"), t );
desc5.putUnitDouble(cTID("Left"), cTID("#Pxl"), l );
desc5.putUnitDouble(cTID("Btom"), cTID("#Pxl"), b );
desc5.putUnitDouble(cTID("Rght"), cTID("#Pxl"), r );
desc5.putUnitDouble(sTID("topRight"), cTID("#Pxl"), corner);
desc5.putUnitDouble(sTID("topLeft"), cTID("#Pxl"), corner);
desc5.putUnitDouble(sTID("bottomLeft"), cTID("#Pxl"), corner);
desc5.putUnitDouble(sTID("bottomRight"), cTID("#Pxl"), corner);
desc2.putObject(cTID("Shp "), cTID("Rctn"), desc5);
desc1.putObject(cTID("Usng"), sTID("contentLayer"), desc2);
executeAction(cTID("Mk "), desc1, DialogModes.NO);
}
}
Copy link to clipboard
Copied
@Kukurykus @r-bin In this script i want to add feather section , Could you add this ?
app.activeDocument.selection.feather(new UnitValue(amt,"px"));
#target photoshop;
app.bringToFront();
main()
function main(){
app.bringToFront();
var row = 6;
var column =6;
var ldivision =10;
var corner = 5;
app.preferences.rulerUnits = Units.PIXELS; //new
if(app.documents.length>0){
var doc = activeDocument;
try{
var doc = activeDocument;
var sBounds = doc.selection.bounds;
var lineAdjW = ldivision/row
var lineAdjH = ldivision/column
var sWidth = (parseFloat(sBounds[2]) -parseFloat(sBounds[0]))/column - ldivision + ldivision/(row ); //modified
var sHeight = (parseFloat(sBounds[3]) -parseFloat(sBounds[1]))/row - ldivision + ldivision/(column ) ; //modified
var leftSide = parseFloat (sBounds[0]);
var topSide = parseFloat (sBounds[1]);
for(var i=0;i<row;i++){
leftSide = parseFloat (sBounds[0]);
for(var j=0;j<column;j++){
Create_Rectangle (topSide, leftSide, topSide + sHeight, leftSide + sWidth, corner) //old code
leftSide += sWidth + ldivision
}
topSide += sHeight +ldivision
}
}
catch(e){}
}
else {alert("There is no open document!")}
function Create_Rectangle(t,l,b,r, corner) {
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putClass(sTID("contentLayer"));
desc1.putReference(cTID("null"), ref1);
var desc2 = new ActionDescriptor();
var desc3 = new ActionDescriptor();
var desc4 = new ActionDescriptor();
desc4.putDouble(cTID("Rd "), Math.random() * 255);
desc4.putDouble(cTID("Grn "), Math.random() * 255);
desc4.putDouble(cTID("Bl "), Math.random() * 255);
desc3.putObject(cTID("Clr "), sTID("RGBColor"), desc4);
desc2.putObject(cTID("Type"), sTID("solidColorLayer"), desc3);
var desc5 = new ActionDescriptor();
desc5.putInteger(sTID("unitValueQuadVersion"), 1);
desc5.putUnitDouble(cTID("Top "), cTID("#Pxl"), t );
desc5.putUnitDouble(cTID("Left"), cTID("#Pxl"), l );
desc5.putUnitDouble(cTID("Btom"), cTID("#Pxl"), b );
desc5.putUnitDouble(cTID("Rght"), cTID("#Pxl"), r );
desc5.putUnitDouble(sTID("topRight"), cTID("#Pxl"), corner);
desc5.putUnitDouble(sTID("topLeft"), cTID("#Pxl"), corner);
desc5.putUnitDouble(sTID("bottomLeft"), cTID("#Pxl"), corner);
desc5.putUnitDouble(sTID("bottomRight"), cTID("#Pxl"), corner);
desc2.putObject(cTID("Shp "), cTID("Rctn"), desc5);
desc1.putObject(cTID("Usng"), sTID("contentLayer"), desc2);
executeAction(cTID("Mk "), desc1, DialogModes.NO);
}
}
Copy link to clipboard
Copied
Load the code via the </> icon (insert code). Your code is wrong, missing spaces in names. The script uses selection only to define borders. Feather won't do anything. What would you like?
Copy link to clipboard
Copied
What is wrong and missing file ?
Is that possible to add the feather section in script ?
Please modify the code
Copy link to clipboard
Copied
What do you want using Feather for?
Copy link to clipboard
Copied
I want to Add Feather Each Shape
Copy link to clipboard
Copied
...
executeAction(cTID("Mk "), desc1, DialogModes.NO);
activeDocument.activeLayer.vectorMaskFeather = 10;
...
Copy link to clipboard
Copied
Thanks @r-bin Well
Copy link to clipboard
Copied
Don't create unrelated to original question posts. Start new thread for it.
Copy link to clipboard
Copied
Loll, that don't belong to main request 😛
Copy link to clipboard
Copied
@r-bin Adove Photoshop CS3 Can't take this line :- activeDocument.activeLayer.vectorMaskFeather = 10;
Copy link to clipboard
Copied
Which other Photoshop release (that you use) do that, that you marked it as correct answer?
Copy link to clipboard
Copied
Maybe.
Try to replace with this code (not tested on CS3)
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));
d.putReference(stringIDToTypeID("null"), r);
var r1 = new ActionReference();
r1.putEnumerated(stringIDToTypeID("path"), stringIDToTypeID("path"), stringIDToTypeID("vectorMask"));
r1.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("to"), r1);
d.putBoolean(stringIDToTypeID("antiAlias"), true);
d.putUnitDouble(stringIDToTypeID("feather"), stringIDToTypeID("pixelsUnit"), 10); // feather is here
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("path"), stringIDToTypeID("path"), stringIDToTypeID("vectorMask"));
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("delete"), d, DialogModes.NO);
var d = new ActionDescriptor();
d.putClass(stringIDToTypeID("new"), stringIDToTypeID("channel"));
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("mask"));
d.putReference(stringIDToTypeID("at"), r);
d.putEnumerated(stringIDToTypeID("using"), stringIDToTypeID("userMaskEnabled"), stringIDToTypeID("revealSelection"));
executeAction(stringIDToTypeID("make"), d, DialogModes.NO);
Copy link to clipboard
Copied
Yes , Working Fine
Copy link to clipboard
Copied
Copy link to clipboard
Copied


-
- 1
- 2