Highlighted

How to read position of all count items in document

New Here ,
Sep 06, 2020

Copy link to clipboard

Copied

Well, I found a position property in the countItem method but I can't figure out how to get access to it.

Annotation 2020-09-06 014800.png.

Adobe Community Professional
Correct answer by Kukurykus | Adobe Community Professional

It covers only points without groups:

 

sTT = stringIDToTypeID;

(ref = new ActionReference()).putProperty(sTT('property'), sTT('countClass'))
ref.putEnumerated(sTT('document'), sTT('ordinal'), sTT('targetEnum'))
count = (lst = executeActionGet(ref).getList(sTT('countClass'))).count
function xy(v1, v2) {return lst.getObjectValue(v1).getDouble(sTT(v2))}
arr = []; for(i = 0; i < count; i++) arr.push([xy(i, 'x'), xy(i, 'y')])

arr.toSource()
TOPICS
Actions and scripting

Views

74

Likes

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

How to read position of all count items in document

New Here ,
Sep 06, 2020

Copy link to clipboard

Copied

Well, I found a position property in the countItem method but I can't figure out how to get access to it.

Annotation 2020-09-06 014800.png.

Adobe Community Professional
Correct answer by Kukurykus | Adobe Community Professional

It covers only points without groups:

 

sTT = stringIDToTypeID;

(ref = new ActionReference()).putProperty(sTT('property'), sTT('countClass'))
ref.putEnumerated(sTT('document'), sTT('ordinal'), sTT('targetEnum'))
count = (lst = executeActionGet(ref).getList(sTT('countClass'))).count
function xy(v1, v2) {return lst.getObjectValue(v1).getDouble(sTT(v2))}
arr = []; for(i = 0; i < count; i++) arr.push([xy(i, 'x'), xy(i, 'y')])

arr.toSource()
TOPICS
Actions and scripting

Views

75

Likes

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
Sep 06, 2020 0
Adobe Community Professional ,
Sep 06, 2020

Copy link to clipboard

Copied

I think nothing like that in Ps, but you can get the info of the point/pixel color and position from the Info panel.

Likes

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
Reply
Loading...
Sep 06, 2020 0
Most Valuable Participant ,
Sep 06, 2020

Copy link to clipboard

Copied

You can set up to 10 Color sampler points and retrieve their positions in a script

var orig_ruler_units = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;	// Set the ruler units to PIXELS
message="Canvas Width=" + app.activeDocument.width.value + " ,Height=" + app.activeDocument.height.value;
for (var s=0,len=app.activeDocument.colorSamplers.length;s<len;s++) {
	var colorSamplerRef = app.activeDocument.colorSamplers[s];
	var rgbC = new SolidColor  
    rgbC.rgb.red = colorSamplerRef.color.rgb.red;  
    rgbC.rgb.green = colorSamplerRef.color.rgb.green;  
    rgbC.rgb.blue = colorSamplerRef.color.rgb.blue;   
    //alert(rgbC.rgb.hexValue)  
	message = message + "\nColorSampler=" + s + " ,x=" + colorSamplerRef.position[0].value + " ,y=" + colorSamplerRef.position[1].value 
	+ " Color=" + rgbC.rgb.hexValue;
} 
alert(message);
app.preferences.rulerUnits = orig_ruler_units;	// Reset units to original settings
JJMack

Likes

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
Reply
Loading...
Sep 06, 2020 1
Adobe Community Professional ,
Sep 06, 2020

Copy link to clipboard

Copied

The professor is here. So everything is possible with scripts.

Likes

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
Reply
Loading...
Sep 06, 2020 0
Adobe Community Professional ,
Sep 06, 2020

Copy link to clipboard

Copied

It covers only points without groups:

 

sTT = stringIDToTypeID;

(ref = new ActionReference()).putProperty(sTT('property'), sTT('countClass'))
ref.putEnumerated(sTT('document'), sTT('ordinal'), sTT('targetEnum'))
count = (lst = executeActionGet(ref).getList(sTT('countClass'))).count
function xy(v1, v2) {return lst.getObjectValue(v1).getDouble(sTT(v2))}
arr = []; for(i = 0; i < count; i++) arr.push([xy(i, 'x'), xy(i, 'y')])

arr.toSource()

Likes

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
Reply
Loading...
Sep 06, 2020 1