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

JavaScript, why methods .selectEllipse(), .selectColumn(), .selectPolygon() and etc don't work?

Community Beginner ,
Jul 04, 2024 Jul 04, 2024

Copy link to clipboard

Copied

This question is a duplicate of my question on stackoverflow, https://stackoverflow.com/questions/78704383/photoshop-javascript-why-docref-selection-selectellipse...

I automate Photoshop using JavaScript, so here is my code:

var originalRulerUnits = app.preferences.rulerUnits
originalRulerUnits = Units.PIXELS

displayDialogs = DialogModes.NO

var fileRef = new File( "C:\\Users\\...\\Desktop\\...\\...\\test.png" );
app.open( fileRef );
var docRef = app.activeDocument;

So this code works fine, but next when I'm trying

docRef.selection.selectEllipse(
{top: 50, left: 70, bottom: 140, right: 100},
SelectionType.EXTEND
);

or 

docRef.selection.selectColumn(90);

with or without await keyword, or

docRef.selection.selectEllipse({top: 0, left: 0, bottom: 100, right: 100});

and etc., nothing happens?

I've found these methods in Adobe documentation:
https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/selection/#selectall but they aren't present in photoshop-javascript-ref-2020.pdf , neither in photoshop-scripting-guide-2020.pdf ( https://github.com/Adobe-CEP/CEP-Resources/tree/master/Documentation/Product%20specific%20Documentat... )

I'm using Photoshop 25.0.0, but those Instruments (-Elliptical Marquee Tool; -Single Column Marquee Tool; -Polygonal Lasso Tool; -Rectangular Marquee Tool) were in Photoshop for many years, and for example methods like .select()

var shapeRef = [ [x2, y2], [width, y2], [width, height], [x2, height] ];
docRef.selection.select(shapeRef, selectionType.EXTEND);

or 

.selectAll()

method works fine.

So what am I doing wrong?

TOPICS
Actions and scripting , Windows

Views

323

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 2 Correct answers

Community Expert , Jul 04, 2024 Jul 04, 2024

Legacy ExtendScript/Action Manager code (.jsx) isn't compatible with the new UXP/BatchPlay code (.psjs). It's one or the other.

Votes

Translate

Translate
Community Expert , Jul 04, 2024 Jul 04, 2024

Yes, exactly. 

 

Because, as you said yourself, these methods can be found in the UXP reference - and not in the Javascript reference.

Votes

Translate

Translate
Adobe
Community Expert ,
Jul 04, 2024 Jul 04, 2024

Copy link to clipboard

Copied

Legacy ExtendScript/Action Manager code (.jsx) isn't compatible with the new UXP/BatchPlay code (.psjs). It's one or the other.

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
Community Beginner ,
Jul 04, 2024 Jul 04, 2024

Copy link to clipboard

Copied

So, do I understand correctly that these new methods (selectColumn, selectEllipse and so on) will only work for UXP/BatchPlay code (.psjs)? And not in .jsx?

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
Community Expert ,
Jul 04, 2024 Jul 04, 2024

Copy link to clipboard

Copied

Yes, exactly. 

 

Because, as you said yourself, these methods can be found in the UXP reference - and not in the Javascript reference.

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
Community Beginner ,
Jul 05, 2024 Jul 05, 2024

Copy link to clipboard

Copied

LATEST

Thank you very much, now I've got 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