And why do you need to know the position of the annotation? You can set any property for the annotation, but you can not read it. This is a bug of Photoshop. You can specify the position for any annotation. var i = 0; while (1) { if (has_annotation(i)) { set_annot_position(i, 10, 10+i*10); i++ } else break; } function has_annotation(idx) { try { var r = new ActionReference(); r.putIndex( stringIDToTypeID( "annotation" ), idx ); var d = new ActionDescriptor(); d.putReference( charIDToTypeID( "null" ), r ); var d1 = new ActionDescriptor(); d1.putObject( charIDToTypeID( "Sz " ), charIDToTypeID( "Ofst" ), new ActionDescriptor()); d.putObject( charIDToTypeID( "T " ), stringIDToTypeID( "annotation" ), d1 ); executeAction( charIDToTypeID( "setd" ), d, DialogModes.NO ); return true; } catch (e) { return false; } } function set_annot_position(idx, x, y) { try { var r = new ActionReference(); r.putIndex( stringIDToTypeID( "annotation" ), idx ); var d = new ActionDescriptor(); d.putReference( charIDToTypeID( "null" ), r ); var d2 = new ActionDescriptor(); d2.putUnitDouble( charIDToTypeID( "Hrzn" ), charIDToTypeID( "#Pxl" ), x ); d2.putUnitDouble( charIDToTypeID( "Vrtc" ), charIDToTypeID( "#Pxl" ), y ); var d1 = new ActionDescriptor(); d1.putObject( charIDToTypeID( "Lctn" ), charIDToTypeID( "Pnt " ), d2 ); d.putObject( charIDToTypeID( "T " ), stringIDToTypeID( "annotation" ), d1 ); executeAction( charIDToTypeID( "setd" ), d, DialogModes.NO ); return true; } catch (e) { return false; } }
... View more