# GetNextMechUnit ACTIVE is not working?

**URL:** <https://tech-community.robotics.abb.com/t/getnextmechunit-active-is-not-working/2046>\
**Category:** RobotStudio\
**Created:** [July 31, 2008, 3:55pm UTC](https://tech-community.robotics.abb.com/t/getnextmechunit-active-is-not-working/2046 "2008-07-31T15:55:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joan](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@Joan](https://tech-community.robotics.abb.com/u/Joan)\
**Post date:** [July 31, 2008, 3:55pm UTC](https://tech-community.robotics.abb.com/t/getnextmechunit-active-is-not-working/2046/1 "2008-07-31T15:55:25Z")

</div>

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.
