Issue
Sample PE program for setting attributes on all objects of a given class in a controller.
Environment
ALL CX Controllers.
Cause
The following PE program is a sample of a program that sets the site codes on ALL the doors found in the controller upon the controller power up.
Resolution
'This program sets the site codes on all the doors in this controller
'Program is autostart and fallthru
'Program is triggered by the MINUTE system variable
'12/16/2011 Abe Meran
'Sample program
Datetime LastStartUp
Object theDoor
INIT:
LastStartUp = PowerUpTime
Goto WAIT1
WAIT1:
If PowerUpTime > LastStartUp then Goto RESET_SITE_CODE
RESET_SITE_CODE:
OpenList("Door", theDoor)
While GetObject(theDoor) is Success
If theDoor Site1 = 0 then theDoor Site1 = 1
If theDoor Site2 = 0 then theDoor Site2 = 2
If theDoor Site3 = 0 then theDoor Site3 = 3
If theDoor Site4 = 0 then theDoor Site4 = 4
Endwhile
CloseList(theDoor)
Goto WAIT1
E:
CloseList(theDoor)
Goto WAIT1
Here is another example of a program residing in a CX that sets the site codes on all the doors of all the ACXs under the CX
Object theACX
Object theDoor
Number OK
If OpenList("InfinetCtlr", theACX) is Success then
While GetObject(theACX) is Success
If OpenList("Door", theDoor, theACX) is Success then
While GetObject(theDoor) is Success
theDoor Site1 = 1111
theDoor Site2 = 2222
theDoor Site3 = 3333
theDoor Site4 = 4444
Endwhile
CloseList(theDoor)
Endif
Endwhile
Endif
Goto 2
2:
CloseList(theACX)
CloseList(theDoor)
Stop