Copy link to clipboard
Copied
I and using javascript
I want to set a rectangular selection.
both of these throw an error and i can't figure why;
app.activeDocument.selection.select([3111.62,936.63,5300.89,4025]);
or
var coverRegion = [3111.62,936.63,5300.89,4025]
app.activeDocument.selection.select(coverRegion);
if I change this to crop it works though. According to the javascript reference guide it the same kind of array of coordinates (left, top, right bottom)
app.activeDocument.crop([3111.62,936.63,5300.89,4025]);
I have tested this as just a single line of code in it's own document and still get "Error 1220: Illegal Argument"
I'm pulling my hair out here.
activeDocument.selection.select([[3111.62, 936.63], [5300.89, 936.63], [5300.89, 4025], [3111.62, 4025]])
Copy link to clipboard
Copied
activeDocument.selection.select([[3111.62, 936.63], [5300.89, 936.63], [5300.89, 4025], [3111.62, 4025]])
Copy link to clipboard
Copied
I just found the answer but this make s it m​uch more clear so thank you.
translated:
Copy link to clipboard
Copied
function rec(l, t, r, b) {activeDocument.selection.select([[l, t], [r, t], [r, b], [l, b]])}
rec(3111.62, 936.63, 5300.89, 4025)