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

Rectangle shape with javascript

Explorer ,
Jul 10, 2020 Jul 10, 2020

Copy link to clipboard

Copied

Hi, 

 

Trying to get familiar with javaScript coding for Photoshop. Reading the documents a lot.

 

However, quick question. Is there any good tutorial on how to create / draw a new simple rectangle to the document? In Illustrator I find it very easy, but only examples I find for Photoshop is to manually draw out a path with coordinates for each point. Maybe this is the way to go? Want to see if there's any easier way to go with a simple shape like a rectangle. 

 

Thanks,

Mike

Views

643

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

Explorer , Jul 13, 2020 Jul 13, 2020

I've managed to figure it out using script listener. Great tool to extract actions in photoshop. It is a bit hard to read though.. but doable. Just need to spend some time cleaning it up. 🙂

Votes

Translate

Translate
Explorer ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

I've managed to figure it out using script listener. Great tool to extract actions in photoshop. It is a bit hard to read though.. but doable. Just need to spend some time cleaning it up. 🙂

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 19, 2020 Jul 19, 2020

Copy link to clipboard

Copied

Hi @MikeCL-zZMTaZ,

you answered your question yourself - but it's still not clear.

 

@MikeCL-zZMTaZ wrote: "… how to create / draw a new simple rectangle to the document? …"

 

What do you really want?

What is a rectangle in your opinion?

  • a selection
  • a selection filled with pixel contents
  • other (pixel) layers contents
  • a work path
  • an path saved in Paths Panel
  • a vector shape
  • the canvas
  • a frame border
  • and so on …

 

All of this can be done. With Javascript (Adobe ExtendScript) and/or Script Listener Code (Action-Manager-Code = AM-Code). But you always have to describe in detail what you really want. Otherwise you will always get no or wrong answers.

 

BTW screenshot before and after and/or sample files are very helpful.

 

 

 

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
Explorer ,
Jul 19, 2020 Jul 19, 2020

Copy link to clipboard

Copied

Yeah.. you're right.. Sorry... It was about a rectangle live shape filled with a color I was after. So I used Javascript (extend script), and in this case, together with AM-Code extracted from the script listener. I will try and be more precise in my questions.. Thanks for pointing that out!

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 19, 2020 Jul 19, 2020

Copy link to clipboard

Copied

LATEST

In this case, the use of AM code is the right choice.

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