score:0

you're mixing photoshop and illustrator dom: photoshop doesn't have pathitems.ellipse or pathitems.rectangle methods. check the photoshop scripting reference to look for specific methods. you can use this snippet to create rectangular or elliptical paths in photoshop:

/**
 creates a new path or adds to an existing path
 example: createpath({
    addtopath: false, // will create a new path
    type: 'rctn', //'elps' for ellipse
    top: 50,
    left: 50,
    bottom: 150,
    right: 150
 })
 */
function createpath(data)
{
    if (data == undefined) return false;
    data.addtopath == undefined && data.addtopath = false;
    data.type == undefined && data.type = 'rctn'; //'elps';

    var desc10 = new actiondescriptor();
    var ref4 = new actionreference();
    if (data.addtopath)
        ref4.putenumerated(ctid('path'), ctid('ordn'), ctid('trgt'));
    else
        ref4.putproperty(ctid('path'), ctid('wrpt'));


    desc10.putreference(ctid('null'), ref4);
    var desc11 = new actiondescriptor();
    desc11.putunitdouble(ctid('top '), ctid('#pxl'), data.top);
    desc11.putunitdouble(ctid('left'), ctid('#pxl'), data.left);
    desc11.putunitdouble(ctid('btom'), ctid('#pxl'), data.bottom);
    desc11.putunitdouble(ctid('rght'), ctid('#pxl'), data.right);
    desc10.putobject(ctid('t   '), ctid(data.type), desc11);
    executeaction(ctid(data.addtopath ? 'addt' : 'setd'), desc10, dialogmodes.no);

    function ctid(s)
    {
        return app.charidtotypeid(s);
    };

    function stid(s)
    {
        return app.stringidtotypeid(s);
    };

}; // end of createpath()

Related Query

More Query from same tag