How to 8 How to Instead of downloadable sample code which comes included in a Visual Studio project, this section provides code snippets for several tasks. Please note that many code snippets are also included in some way or another in one of our sample code downloads [ } 67] , which should allow you to understand its usage in an overall picture. How To How to - Activate a previously created configuration [ } 69] How to - Link variables [ } 70] How to - Unlink variables [ } 70] How to - Disable/enable a tree item (e.g.
an I/O device) [ } 71] How to - Change the path to a plc project and/or rescan the project [ } 71] How to - Change the fieldbus address (station no.) of a profibus box [ } 72] How to - Export/import the information of a child of a tree item [ } 73] How to - Enumerate through the child's of a tree item [ } 74] How to - Add child items (devices, boxes, terminals, variables etc.) [ } 75] How to - Update the address information of I/O devices [ } 75] How to - Create/change a linkage of a nc axis, encoder or drive to an I/O device, box or terminal [ } 76] How to - Exchange a fieldbus device and move all childs to the new one [ } 77] How to - Add a route to a remote ADS target [ } 79] How to - Execute a broadcast search [ } 81] 8.1 How to activate a previously created configuration Requirements To activate a previously created configuration, an instance of the TwinCAT System Manager must be created, the configuration has to be loaded and activated.
Procedure The ProgId " TCatSysManager.TcSysManager " can be used to create an instance of the System Manager that implements the ITcSysManager [ } 30] interface. This interface allows same basic operations with TwinCAT configurations. Sample (vbscript): dim tsm set tsm = CreateObject("TCatSysManager.TcSysManager") call tsm.OpenConfiguration("c:\twincat\myConfig.wsm") call tsm.ActivateConfiguration Sample (javascript): var tsm tsm = ActiveXObject("TCatSysManager.TcSysManager"); tsm.OpenConfiguration("c:\twincat\myConfig.wsm"); tsm.ActivateConfiguration(); Automation Interface 69 Version: 1.2