How to resize selection??
what wrong with the code??
//
app.activeDocument.selection.selectAll()
app.activeDocument.selection.copy()
app.activeDocument.selection.resizeBoundary(50,300,AnchorPosition.MIDDLECENTER)
//
How to resize selection??
How to resize selection??
- Attachments
-
- v2.jpg (150.56 KiB) Viewed 17149 times
-
- v1.jpg (42.73 KiB) Viewed 17149 times
Re: How to resize selection??
Bonjour
You can use Methods
contract()
expand()
docRef.selection.expand(1) ( 1 pixel )
docRef.selection.contract(1)
You can use Methods
contract()
expand()
docRef.selection.expand(1) ( 1 pixel )
docRef.selection.contract(1)
Re: How to resize selection??
Thank you Txuku
but I want make the selections value=3mm
have any way ??
but I want make the selections value=3mm
have any way ??
Re: How to resize selection??
Hum ...........
It seems to me that
You have to calculate it ???
It seems to me that
You have to calculate it ???

Re: How to resize selection??
I don't know the other way!!
Re: How to resize selection??
Bonjour
After research I think it is better to avoid the method
SelectAll() and select the document with at least one pixel.
Then the resizeBoundary () and other methods work without errors
Test this:
After research I think it is better to avoid the method
SelectAll() and select the document with at least one pixel.
Then the resizeBoundary () and other methods work without errors
Test this:
Code: Select all
startRulerUnits = app.preferences.rulerUnits;
startTypeUnits = app.preferences.typeUnits;
startDisplayDialogs = app.displayDialogs;
var docRef = app.activeDocument;
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS;
app.displayDialogs = DialogModes.NO;
var largeur = docRef.width.as('px');
//alert(largeur)
app.preferences.rulerUnits = Units.PIXELS//CM//PIXELS
//app.preferences.typeUnits = TypeUnits.PIXELS//CM
app.displayDialogs = DialogModes.NO;
var largeur = docRef.width.as('px')//px'); ou as('mm')
var hauteur = docRef.height.as('px');
//alert(largeur)
//Selection : la taille de l image moins 1 px - selectAll() ne passe pas
LEFT = 0;
RIGHT = largeur-1;
TOP = 0
BOTTOM = hauteur-1;
var shapeRef = [
[LEFT,TOP],
[LEFT,BOTTOM],
[RIGHT,BOTTOM],
[RIGHT,TOP]
]
app.activeDocument.selection.select(shapeRef);
app.activeDocument.selection.resizeBoundary(50,300,AnchorPosition.MIDDLECENTER)
app.preferences.rulerunits = startRulerUnits;
app.preferences.typeunits = startTypeUnits;
app.displayDialogs = startDisplayDialogs;
-
- Posts: 45
- Joined: Fri Nov 04, 2016 8:29 am
Re: How to resize selection??
am not an expert but am pretty sure the easiest way is to get the "Boundary" (Bound) of the current selection , delete it and then create a new selection after doing the required modifications/resizing !
-
- Posts: 26
- Joined: Mon Aug 01, 2016 8:59 pm
Re: How to resize selection??
Yes.wasfiwasfi wrote:am not an expert but am pretty sure the easiest way is to get the "Boundary" (Bound) of the current selection , delete it and then create a new selection after doing the required modifications/resizing !
I'm totally agree with you.
Re: How to resize selection??
Undoubtedly ........ exact! 

Re: How to resize selection??
Thank you txuku!!