Quantcast
Channel: Adobe Community : Unanswered Discussions - Photoshop
Viewing all articles
Browse latest Browse all 74445

How to create a line without using execute action method.

$
0
0

Hi All,

 

I want to create a line whose weight and co-ordinate are given to me. I am using ActionDescriptor and execute action method to do this.

 

Here is my code:

 

    var idcontentLayer = stringIDToTypeID( "contentLayer" );

    var idStrt = charIDToTypeID( "Strt" );

    var idHrzn = charIDToTypeID( "Hrzn" );

    var idPxl = charIDToTypeID( "#Pxl" );

    var idVrtc = charIDToTypeID( "Vrtc" );

    var idPnt = charIDToTypeID( "Pnt " );

 

    var actRef = new ActionReference();

    actRef.putClass( idcontentLayer );

    var layerDesc = new ActionDescriptor();

    layerDesc.putReference( charIDToTypeID( "null" ), actRef );

    var lineDesc = new ActionDescriptor();

    lineDesc.putClass( charIDToTypeID( "Type" ), stringIDToTypeID( "solidColorLayer" ) );

    var propertyDesc = new ActionDescriptor();

    var strtPointDesc = new ActionDescriptor();

    strtPointDesc.putUnitDouble( idHrzn, idPxl,  startX);                         //startX, startY, endX, endY are given..

    strtPointDesc.putUnitDouble( idVrtc, idPxl, startY);

    var endPointDesc = new ActionDescriptor();

    endPointDesc.putUnitDouble( idHrzn, idPxl, endX );

    endPointDesc.putUnitDouble( idVrtc, idPxl, endY );

    propertyDesc.putObject(  charIDToTypeID( "Strt" ), idPnt, strtPointDesc );

    propertyDesc.putObject( charIDToTypeID( "End " ), idPnt, endPointDesc);

    propertyDesc.putUnitDouble( charIDToTypeID( "Wdth" ), idPxl, weight );               // weight is given.

    lineDesc.putObject( charIDToTypeID( "Shp " ), charIDToTypeID( "Ln  " ), propertyDesc );

    layerDesc.putObject( charIDToTypeID( "Usng" ), idcontentLayer, lineDesc );

    executeAction( charIDToTypeID( "Mk  " ), layerDesc, DialogModes.NO );

 

 

Is there any other way to do the above (using photoshop scripting method)?

 

Thanks,
AI


Viewing all articles
Browse latest Browse all 74445

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>