• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Circles with Javascript

New Here ,
Mar 28, 2008 Mar 28, 2008

Copy link to clipboard

Copied

I'm attempting to script the drawing a number of circles and doughnut type shapes on a document. Is there any way of doing this directly from within a script, rather than recording the action with the script listener, then modifying the output? E.g. is there an ellipse or circle function that I can program directly?

Look forward to any comments

David
TOPICS
Actions and scripting

Views

324

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Mar 28, 2008 Mar 28, 2008

Copy link to clipboard

Copied

Here you go.
make sure you change ('T ') to T and Three Spaces!
Paul.

var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
Circle(0,0,300,300);
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;

function Circle(Top,Left,Bottom,Right) {
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };

var desc3 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty( cTID('Chnl'), cTID('fsel') );
desc3.putReference( cTID('null'), ref1 );
var desc4 = new ActionDescriptor();
desc4.putUnitDouble( cTID('Top '), cTID('#Pxl'), Top );
desc4.putUnitDouble( cTID('Left'), cTID('#Pxl'), Left );
desc4.putUnitDouble( cTID('Btom'), cTID('#Pxl'), Bottom );
desc4.putUnitDouble( cTID('Rght'), cTID('#Pxl'), Right );
desc3.putObject( cTID('T '), cTID('Elps'), desc4 );
desc3.putBoolean( cTID('AntA'), true );
executeAction( cTID('setd'), desc3, DialogModes.NO );
};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2008 Mar 28, 2008

Copy link to clipboard

Copied

LATEST
Thanks Paul - perfect solution!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines