
  /////////////////////////////
  // 
  //  This code was written as an example code, modify it your needs !
  //  This code is explained in the tutorials over at [http://www.kirupa.com] look for the 'scripting' tutorials
  //  Written by mlk over at www.kirupaforum.com, post over there for help !
  //
  //  [mlkdesign@online.fr]
  //  july 2004
  //

function makeCircle(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 );
}

var defaultRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;


var newDocumentRef = app.documents.add(600,600, 72.0, "Circles")
newDocumentRef = null;

for(a=10;a<=40;a++){
	var randomColor = new SolidColor;
		randomColor.rgb.red = Math.round(Math.random()*255);
		randomColor.rgb.green = Math.round(Math.random()*255);
		randomColor.rgb.blue = Math.round(Math.random()*255);

makeCircle(a*3,a*3,a*5*3,a*5*3,true);

activeDocument.selection.fill(randomColor);
}


app.preferences.rulerUnits = defaultRulerUnits; 


/*
function makeCircle(left,top,right,bottom,antiAlias){

var circleSelection = charIDToTypeID( "setd" );
    var desc11 = new ActionDescriptor();
    var id71 = charIDToTypeID( "null" );
        var ref5 = new ActionReference();
        var id72 = charIDToTypeID( "Chnl" );
        var id73 = charIDToTypeID( "fsel" );
        ref5.putProperty( id72, id73 );
    desc11.putReference( id71, ref5 );
    var id74 = charIDToTypeID( "T   " );
        var desc12 = new ActionDescriptor();
        var id75 = charIDToTypeID( "Top " );
        var id76 = charIDToTypeID( "#Pxl" );
        desc12.putUnitDouble( id75, id76, top );
        var id77 = charIDToTypeID( "Left" );
        var id78 = charIDToTypeID( "#Pxl" );
        desc12.putUnitDouble( id77, id78, left );
        var id79 = charIDToTypeID( "Btom" );
        var id80 = charIDToTypeID( "#Pxl" );
        desc12.putUnitDouble( id79, id80, bottom );
        var id81 = charIDToTypeID( "Rght" );
        var id82 = charIDToTypeID( "#Pxl" );
        desc12.putUnitDouble( id81, id82, right );
    var id83 = charIDToTypeID( "Elps" );
    desc11.putObject( id74, id83, desc12 );
    var id84 = charIDToTypeID( "AntA" );
    desc11.putBoolean( id84, antiAlias );
executeAction( circleSelection, desc11, DialogModes.NO );
}
*/
