WinCC V7.4 WinCC: Scripting (VBS, ANSI-C, - Siemens
SIMATIC HMI
WinCC V7.4 WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual
VBS for Creating Procedures and Actions
1
ANSI-C for Creating Functions and Actions
2
VBA for Automated Configuration
3
Print of the Online Help
02/2016
A5E37536061-AA
Legal information
Warning notice system This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are graded according to the degree of danger.
DANGER indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION indicates that minor personal injury can result if proper precautions are not taken.
NOTICE indicates that property damage can result if proper precautions are not taken. If more than one degree of danger is present, the warning notice representing the highest degree of danger will be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to property damage.
Qualified Personnel The product/system described in this documentation may be operated only by personnel qualified for the specific task in accordance with the relevant documentation, in particular its warning notices and safety instructions. Qualified personnel are those who, based on their training and experience, are capable of identifying risks and avoiding potential hazards when working with these products/systems.
Proper use of Siemens products Note the following:
WARNING Siemens products may only be used for the applications described in the catalog and in the relevant technical documentation. If products and components from other manufacturers are used, these must be recommended or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and maintenance are required to ensure that the products operate safely and without any problems. The permissible ambient conditions must be complied with. The information in the relevant documentation must be observed.
Trademarks All names identified by ? are registered trademarks of Siemens AG. The remaining trademarks in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability We have reviewed the contents of this publication to ensure consistency with the hardware and software described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the information in this publication is reviewed regularly and any necessary corrections are included in subsequent editions.
Siemens AG Division Digital Factory Postfach 48 48 90026 N?RNBERG GERMANY
A5E37536061-AA 03/2016 Subject to change
Copyright ? Siemens AG 2016. All rights reserved
Table of contents
1 VBS for Creating Procedures and Actions.................................................................................................11
1.1
VBS for creating procedures and actions...............................................................................11
1.2
Using Visual Basic Script in WinCC.......................................................................................12
1.3
Modules and Procedures.......................................................................................................15
1.4
Actions...................................................................................................................................18
1.5
Multiple Use of Procedures and Actions................................................................................20
1.6
Use of CrossReference..........................................................................................................22
1.7
Using Global Tags in VBS......................................................................................................24
1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5
VBScript Editors.....................................................................................................................26 VBScript Editors.....................................................................................................................26 Global Script Editor................................................................................................................27 Working in an Editing Window...............................................................................................30 Working with the Toolbars......................................................................................................33 Deleting Actions or Procedures..............................................................................................35
1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8
Creating and Editing Procedures...........................................................................................36 Creating and Editing Procedures...........................................................................................36 Creating a New Procedure.....................................................................................................39 How to Write Procedure Codes..............................................................................................41 Using Standard and Project Procedures................................................................................44 How to add module-related information.................................................................................45 Protecting a Module with a Password....................................................................................47 Saving a Procedure................................................................................................................48 Renaming a Procedure or Module.........................................................................................50
1.10 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.10.6 1.10.7 1.10.7.1 1.10.7.2 1.10.7.3 1.10.7.4 1.10.7.5 1.10.7.6 1.10.8
Creating and Editing Actions..................................................................................................52 Creating and Editing Actions..................................................................................................52 Creating a New Action...........................................................................................................56 How to Edit Actions................................................................................................................57 How to add action-related information...................................................................................60 Protecting an Action with a Password....................................................................................62 Saving Actions.......................................................................................................................63 Triggers..................................................................................................................................64 Triggers..................................................................................................................................64 Animation trigger....................................................................................................................68 How to add a trigger of the type "Timer"................................................................................70 How to add a trigger of the type "Tag"...................................................................................72 How to change a trigger.........................................................................................................74 How to delete a trigger...........................................................................................................75 How to Rename an Action.....................................................................................................76
1.11
How to activate global actions in Runtime.............................................................................78
1.12
Diagnostics.............................................................................................................................80
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 02/2016, A5E37536061-AA
3
Table of contents
1.12.1 1.12.2 1.12.2.1 1.12.2.2 1.12.2.3 1.12.2.4 1.12.3 1.12.3.1 1.12.3.2 1.12.3.3 1.12.4 1.12.4.1 1.12.4.2 1.12.4.3 1.12.4.4 1.12.4.5 1.12.4.6 1.12.4.7 1.12.4.8 1.12.4.9 1.12.4.10 1.12.4.11 1.12.4.12
1.13
1.14 1.14.1 1.14.2 1.14.2.1 1.14.2.2 1.14.2.3 1.14.2.4 1.14.2.5 1.14.2.6 1.14.2.7 1.14.2.8 1.14.2.9 1.14.2.10 1.14.2.11 1.14.2.12 1.14.2.13 1.14.2.14 1.14.2.15 1.14.2.16 1.14.2.17 1.14.2.18 1.14.2.19 1.14.2.20 1.14.2.21 1.14.2.22 1.14.2.23 1.14.3
Diagnostics.............................................................................................................................80 GSC Diagnostics....................................................................................................................81 GSC Diagnostics....................................................................................................................81 Inserting the GSC Diagnostics Window into a Picture...........................................................82 GSC Diagnostics Attributes....................................................................................................82 GSC Diagnostics Toolbar.......................................................................................................83 GSC Runtime.........................................................................................................................84 GSC Runtime.........................................................................................................................84 How to insert the GSC Runtime Window into a Picture.........................................................85 GSC Runtime Attributes.........................................................................................................86 Testing with the Debugger.....................................................................................................87 Testing with the Debugger.....................................................................................................87 How to Activate the Debugger...............................................................................................89 Principles of Debugging.........................................................................................................90 Structure of VBScript Files.....................................................................................................92 Action and Procedure Names in the Debugger......................................................................94 Selecting a Script for Editing..................................................................................................96 Processing Scripts Step-by-Step...........................................................................................97 Setting Breakpoints................................................................................................................98 Deleting Breakpoints..............................................................................................................99 How to Set Bookmarks in Scripts.........................................................................................100 How to Determine and Modify Tag and Property Values.....................................................101 Executing Script Commands................................................................................................102
Printing VBScripts................................................................................................................104
VBS Reference....................................................................................................................105 VBS Reference....................................................................................................................105 Objects and Lists..................................................................................................................107 Objects and Lists..................................................................................................................107 Alarm object.........................................................................................................................110 Alarms object (list)................................................................................................................110 AlarmLogs Object.................................................................................................................112 DataItem Object...................................................................................................................113 DataLogs Object..................................................................................................................114 DataSet Object (List)............................................................................................................116 HMIRuntime Object..............................................................................................................118 Item Object...........................................................................................................................119 Layer Object.........................................................................................................................120 Layers Object (Listing).........................................................................................................121 Logging Object.....................................................................................................................122 ProcessValue Object............................................................................................................123 ProcessValues Object (List).................................................................................................124 Project Object.......................................................................................................................124 ScreenItem Object...............................................................................................................125 ScreenItems Object (List).....................................................................................................129 Screen Object......................................................................................................................131 Screens Object (List)............................................................................................................134 SmartTags Object................................................................................................................136 Tag Object............................................................................................................................137 Tags Object (List).................................................................................................................140 TagSet Object (List).............................................................................................................141 Object types of the ScreenItem object.................................................................................143
WinCC: Scripting (VBS, ANSI-C, VBA)
4
System Manual, 02/2016, A5E37536061-AA
Table of contents
1.14.3.1 1.14.3.2 1.14.3.3 1.14.3.4 1.14.3.5 1.14.3.6 1.14.3.7 1.14.3.8 1.14.4 1.14.4.1 1.14.4.2 1.14.4.3 1.14.4.4 1.14.4.5 1.14.4.6 1.14.4.7 1.14.4.8 1.14.4.9 1.14.4.10 1.14.4.11 1.14.4.12 1.14.4.13 1.14.4.14 1.14.4.15 1.14.4.16 1.14.4.17 1.14.4.18 1.14.4.19 1.14.4.20 1.14.4.21 1.14.4.22 1.14.4.23 1.14.5 1.14.5.1 1.14.5.2 1.14.5.3 1.14.5.4 1.14.5.5 1.14.5.6 1.14.5.7 1.14.6 1.14.6.1
1.15 1.15.1 1.15.2 1.15.2.1 1.15.2.2 1.15.2.3 1.15.2.4 1.15.2.5 1.15.2.6 1.15.2.7
Object types of the ScreenItem object.................................................................................143 Standard objects..................................................................................................................144 Smart objects.......................................................................................................................169 Windows objects..................................................................................................................201 Tube objects.........................................................................................................................215 Controls................................................................................................................................218 Customized Object...............................................................................................................298 Group...................................................................................................................................300 Properties.............................................................................................................................301 Properties.............................................................................................................................301 A...........................................................................................................................................302 B...........................................................................................................................................321 C...........................................................................................................................................362 D...........................................................................................................................................397 E...........................................................................................................................................407 F...........................................................................................................................................416 G..........................................................................................................................................438 H...........................................................................................................................................442 I............................................................................................................................................451 L...........................................................................................................................................457 M..........................................................................................................................................488 N...........................................................................................................................................509 O..........................................................................................................................................512 P...........................................................................................................................................528 Q..........................................................................................................................................546 R...........................................................................................................................................547 S...........................................................................................................................................557 T...........................................................................................................................................595 U...........................................................................................................................................671 V...........................................................................................................................................680 W..........................................................................................................................................697 X - Z.....................................................................................................................................702 Methods...............................................................................................................................710 Methods...............................................................................................................................710 Methods A to E.....................................................................................................................712 Get methods.........................................................................................................................720 Methods H to M....................................................................................................................769 Methods N to R....................................................................................................................779 Methods S to T.....................................................................................................................797 Methods U to Z.....................................................................................................................812 Appendix..............................................................................................................................820 Error Messages from Database Area...................................................................................820
Examples of VBScript..........................................................................................................823 Examples of VBScript..........................................................................................................823 Examples in WinCC.............................................................................................................823 Examples in WinCC.............................................................................................................823 Example: Accessing objects in Graphics Designer..............................................................824 Example: Defining the color of objects.................................................................................825 Example: How to Configure Language Changes.................................................................825 Example: Deactivating Runtime...........................................................................................826 Example: Configuring change picture globally.....................................................................826 Example: Configuring Change Picture Via Property............................................................827
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 02/2016, A5E37536061-AA
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.