Skip to main content
Inspiring
July 10, 2020
解決済み

Rectangle shape with javascript

  • July 10, 2020
  • 返信数 3.
  • 1123 ビュー

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

    このトピックへの返信は締め切られました。
    解決に役立った回答 MikeCL9226041

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

    返信数 3

    pixxxelschubser
    Community Expert
    Community Expert
    July 19, 2020

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

    pixxxelschubser
    Community Expert
    Community Expert
    July 19, 2020

    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.

     

     

     

    MikeCL9226041作成者
    Inspiring
    July 19, 2020

    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!

    MikeCL9226041作成者解決!
    Inspiring
    July 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. 🙂