The preview button just runs the detection on the current frame. So you will have to emulate that in your script.
My suggestion would be to simply call the detection on a frame with a low enough threshold, sort the spots you get by descending order of
QUALITY and retains only the first
Would that work for you?