How to use ModifyImage in for loop?

Hi.
I'm a newbie of Igor Pro.

I attached the screen shot.

I displayed three image graph and I want to change the max and min of the color scale bar using the function.
But, If I execute the function 'scale(mi,mx)' it applied only the window what i click before.

Help me please.

How about using the /W flag on ModifyImage. Assuming that the 3 graphs are the only ones which are displayed:

function scale(mi,mx)
    variable mi, mx
   
    String TheGraphs = WinList("*", ";", "WIN:1")
    variable i
   
    do
        String ThisGraph = StringFromList(i, TheGraphs)
        if (strlen(ThisGraph) == 0)
            break
        endif
       
        ModifyImage /W=$ThisGraph ''#0, ctab = {mi,mx, YellowHot,0}
        i+=1

    while(1)       
end