• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Create Shape in Marquee Tool

Participant ,
Jun 18, 2021 Jun 18, 2021

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

tr1.JPG

 

tr2.JPG

TOPICS
Actions and scripting

Views

6.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jun 19, 2021 Jun 19, 2021

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
...

Votes

Translate

Translate
Adobe
Participant ,
Jun 19, 2021 Jun 19, 2021

Copy link to clipboard

Copied

I want to Every Shape will be colorful for each shape different color

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 20, 2021 Jun 20, 2021

Copy link to clipboard

Copied

1. Use pre-defined array with RGB values

2. Use Math.random() * 255 for each color component

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 20, 2021 Jun 20, 2021

Copy link to clipboard

Copied

Can you share the script file

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 20, 2021 Jun 20, 2021

Copy link to clipboard

Copied

what exactly is your problem?

2021-06-20_21-17-20.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 20, 2021 Jun 20, 2021

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")); 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 21, 2021 Jun 21, 2021

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);
    }
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 21, 2021 Jun 21, 2021

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);
}
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 21, 2021 Jun 21, 2021

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 21, 2021 Jun 21, 2021

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

What do you want using Feather for?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

I want to Add Feather Each Shape 

 

sssaaaaa.JPG

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

...

executeAction(cTID("Mk  "), desc1, DialogModes.NO);
activeDocument.activeLayer.vectorMaskFeather = 10;

...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

Thanks @r-bin  Well 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

Don't create unrelated to original question posts. Start new thread for it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

Loll, that don't belong to main request 😛

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

@r-bin  Adove Photoshop CS3 Can't take this line :- activeDocument.activeLayer.vectorMaskFeather = 10;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

Which other Photoshop release (that you use) do that, that you marked it as correct answer?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 21, 2021 Jun 21, 2021

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);

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

LATEST

Yes , Working Fine 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines