I need a script for photoshop which can create a square or rectangular selection (use rectangular marquee tool) and it will snap to the guides line, no matter the position of the guides, sometimes with 2 guides sometimes I will add 4 guides. Or it’ll be ok if the script make a selection from the guide to the bottom of the photo.
Here are some other options that I’m expecting
make selection 1
make selection 2
2
Answers
First up, should understand that SO is not a code writing service. Also, you should include a minimal, reproducible example of code.
Ok, on with your question:
You can get the rectangular coordinates of a selection with selection bounds.
It’s just a case of adding a horizontal or vertical guide to those bounds:
The code for the guides was taken from the script listener.
Here script that creates a rectangular selection:
To run it, create a file with the extension jsx. For example: script.jsx
Then File->Scripts->Browse… select the file script.jsx