You'll have to use JavaScript to do this. The StarDetector object is the best option. To get a first grasp of this object, here is an example that will create a mask with all stars detected on the current image:
#include <pjsr/StarDetector.jsh>
var S = new StarDetector;
S.test( ImageWindow.activeWindow.mainView.image, true/*createStarmask*/ );
Activate the generated mask on the image and inspect it. You'll see a circle drawn centered on each detected star.
A more interesting example:
#include <pjsr/StarDetector.jsh>
var S = new StarDetector;
var stars = S.stars( ImageWindow.activeWindow.mainView.image );
var f = File.createFileForWriting( "/tmp/stars.txt" );
for ( let i = 0; i < stars.length; ++i )
f.outTextLn( format( "%5d %8.2f %8.2f %8.3f", i, stars[i].pos.x, stars[i].pos.y, stars[i].flux ) );
f.close();
This example will create a new text file where each line corresponds to a detected star. The columns are: star index, X coordinate, Y coordinate, and star flux (accumulated pixel data on the star detection region). Obviously, star detection works best on linear images.
You can also use the StarAlignment process, although it doesn't provide information on star fluxes. The StarAlignment.outputData property contains relevant data for all stars used for alignment after a successful execution of the StarAlignment process. Here is a schematic example:
#define NUMBER_OF_PAIR_MATCHES 2
#define REFERENCE_X 29
#define REFERENCE_Y 30
#define TARGET_X 31
#define TARGET_Y 32
let SA = new StarAlignment;
if ( SA.executeOn( view ) )
{
let stars = [];
let n = SA.outputData[0][NUMBER_OF_PAIR_MATCHES];
for ( let i = 0; i < n; ++i )
stars.push( { refX:SA.outputData[0][REFERENCE_X][i],
refY:SA.outputData[0][REFERENCE_Y][i],
tgtX:SA.outputData[0][TARGET_X][i],
tgtY:SA.outputData[0][TARGET_Y][i] } );
}
This would create an array of objects, where refX,refY are the image coordinates of a reference star and tgtX,tgtY are the corresponding coordinates of the same star matched on the target image (the image in the 'view' object in the example above). Coordinates are in pixels, where 0,0 is the top left corner of the pixel at the top left corner of the image. As noted before, StarAlignment does not provide star fluxes.
Let me know if this helps.