I am trying to create a script in an Archestra graphic that will eventually talk to an Omron PLC. I need to access the elements that I create for the control by reference. It's simple in Visual Basic but I can't figure out if Archestra scripting can do this. For simplicity sake, I have created a simple graphic that has a couple of comboboxes that I want to put data in. I can do combo1.value = "2", combo2.value = "2" and so forth. I would like to use a loop to do this, such as
dim tmpElement as Indirect;
for t = 1 to x ' number of comboboxes I have
tmpElement.BindTo("combo" & t & ".Value");
'I wave a small wait loop per Wonderware tech note here for the Bind to Complete
tmpElement.value = 2;next
This doesn't work. I get a Failed to bind error. It seems BindTo only works for IO attributes. SetCustomProperty seemed promising but the command only works on custom properties, not controls in your graphic. In VB you create an object and can do this type of indirect referencing. Any one ever done this? It sure would make it easier to loop through these boxes or whatever control one would use and load the value from an array vs. doing each manual entry. Thanks for your time
dim tmpElement as Indirect;
for t = 1 to x ' number of comboboxes I have
tmpElement.BindTo("combo" & t & ".Value");
'I wave a small wait loop per Wonderware tech note here for the Bind to Complete
tmpElement.value = 2;next
This doesn't work. I get a Failed to bind error. It seems BindTo only works for IO attributes. SetCustomProperty seemed promising but the command only works on custom properties, not controls in your graphic. In VB you create an object and can do this type of indirect referencing. Any one ever done this? It sure would make it easier to loop through these boxes or whatever control one would use and load the value from an array vs. doing each manual entry. Thanks for your time