Analyze Particles script with Weka Segmentation

Hey!

I’m trying to automate Weka segmentation process. My goal is to use the ‘Analyze Particles’ function with the Weka segmentation. From this link I tried to use the example, but it helps me only with the Weka segmentation process. I dont know how to add the pre-segmentation processes of calibration and cropping, and also the post-segmentation processes of thresholding and activating the ‘Analyze Particles’ function.

Im new to Beanshell. I succeeded to write a Macros script for most of the processes, but then I realized that I have to use Beanshell script for the Weka segmentation process. How can I write one script that will untie everything?

Thanks!