You have strange questions. Why do you need to return something from the function? Access to the selection is possible through the activeDocument.selection property anywhere in the code. You can return it from the function using the return operator. return activeDocument.selection; To make sure that your code causes a crash, add one more line (with alert) to your function select_rect(activeDocument, 1, 1, 100, 100);
function select_rect(source_img, left, top, right, bottom) {
source_img.selection.select([
[left, top],
[right, top],
[right, bottom],
[left, bottom]
]);
select_rect=source_img.selection;
alert(select_rect);
} ----------------------------------------------------------------------------------------------------- And the answer to your strange question var sel = select_Ellipse(activeDocument, 1,1,150,40,true);
alert(sel);
function select_Ellipse(sourceImg, left,top,right,bottom,antiAlias){
var circleSelection = charIDToTypeID( "setd" );
var descriptor = new ActionDescriptor();
var id71 = charIDToTypeID( "null" );
var ref5 = new ActionReference();
var id72 = charIDToTypeID( "Chnl" );
var id73 = charIDToTypeID( "fsel" );
ref5.putProperty( id72, id73 );
descriptor.putReference( id71, ref5 );
var id74 = charIDToTypeID( "T " );
var desc12 = new ActionDescriptor();
var top1 = charIDToTypeID( "Top " );
var top2 = charIDToTypeID( "#Pxl" );
desc12.putUnitDouble( top1, top2, top );
var left1 = charIDToTypeID( "Left" );
var left2 = charIDToTypeID( "#Pxl" );
desc12.putUnitDouble( left1, left2, left );
var bottom1 = charIDToTypeID( "Btom" );
var bottom2 = charIDToTypeID( "#Pxl" );
desc12.putUnitDouble( bottom1, bottom2, bottom );
var right1 = charIDToTypeID( "Rght" );
var right2 = charIDToTypeID( "#Pxl" );
desc12.putUnitDouble( right1, right2, right );
var id83 = charIDToTypeID( "Elps" );
descriptor.putObject( id74, id83, desc12 );
var id84 = charIDToTypeID( "AntA" );
descriptor.putBoolean( id84, antiAlias );
executeAction(circleSelection, descriptor, DialogModes.NO );
return sourceImg.selection;
}
... View more