Multi-measure dialog appearing if called from a function

Hi, I have an issue with calling a function in my macro:
In my macro, if I run the following macro calling it from the macro folder (runMacro(“RGB_Stack”)) the “Multi-measure” dialog window doesn’t pop-up, which is what I want. However, when I call the “RGB_Stack” function in another function in my macro, the “Multi-measure” window does pop-up, and I need to select ‘OK’ to continue. Why is this happening? Captura

function RGB_Stack() {
run("Set Measurements...", "mean redirect=None decimal=3");
setBatchMode(true);
run("Duplicate...", " ");
run("RGB Stack");
roiManager("multi-measure measure_all one append");
setResult("Channel", 0, "R");
setResult("Channel", 1, "G");
setResult("Channel", 2, "B");
setBatchMode(false);
}

The “Multi-measure” command requires at least one ROI Manager selection. Here is an updated version of your function that works as expected:

  run("Leaf (36K)");
  RGB_Stack();

  function RGB_Stack() {
     run("Set Measurements...", "mean redirect=None decimal=3");
     setBatchMode(true);
     run("Duplicate...", " ");
     run("RGB Stack");
     run("Select All");
     roiManager("Add");
     roiManager("multi-measure measure_all one append");
     setResult("Channel", 0, "R");
     setResult("Channel", 1, "G");
     setResult("Channel", 2, "B");
     close;
  }

Thanks for your answer.
I finally noticed that there was no selection because I was using the “Enlarge” function to crop my ROIs. I solved it by using a larger number so my ROIs were all still visible. I assume the factor was too high and therefore it made my ROI selection disappear and forced the pop-up window.
Cheers.