RobotStudio event

GetNextMechUnit ACTIVE is not working?

Options
Hello all,

If from my program I try to use GetNextMechUnit, I cannot get the desired result...  I want to get the names only of ACTIVE units.

I've made this code snippet to test it:

************************************************************ ******
MODULE mainmodule

  PROC Main ()

    VAR num listno := 0;
    VAR string name := "";
    VAR bool b := FALSE;
    TPWrite "List of mechanical units:";
    WHILE GetNextMechUnit(listno, name Active := b)
    DO
        IF (b)
        THEN
           TPWrite "ACTIVE: " + name;
        ELSE
           TPWrite "INACTIVE: " + name;
        ENDIF
       ! listno := listno + 1 is done by GetNextMechUnit
    ENDWHILE

  ENDPROC

ENDMODULE
************************************************************ ******

The problem here is that all the robots seem that are active even if I have deactivated them from the flex pendant... (you know, that first icon over the yellow gears on the right side of the flex pendant).

Any idea on why it is happening?

As always thank you in advance.