WinCCInformationSystemScripting_en-US.pdf

(12317 KB) Pobierz
VBS for Creating Procedures
and Actions
1
ANSI-C for Creating
Functions and Actions
2
3
ANSI-C function descriptions
SIMATIC HMI
VBA for Automated
Configuration
4
WinCC V7.0 SP1
MDM - WinCC: Scripting (VBS,
ANSI-C, VBA)
System Manual
Print of the Online Help
11/2008
754761364.050.png 754761364.059.png 754761364.060.png 754761364.061.png 754761364.001.png 754761364.002.png 754761364.003.png 754761364.004.png 754761364.005.png 754761364.006.png 754761364.007.png 754761364.008.png 754761364.009.png 754761364.010.png 754761364.011.png 754761364.012.png
 
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
with a safety alert symbol, indicates that minor personal injury can result if proper precautions are not taken.
CAUTION
without a safety alert symbol, indicates that property damage can result if proper precautions are not taken.
NOTICE
indicates that an unintended result or situation can occur if the corresponding information is not taken into account.
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 for the specific task, 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 adhered to. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of the 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
Industry Sector
Postfach 48 48
90026 NÜRNBERG
GERMANY
Copyright © Siemens AG 2008.
Technical data subject to change
Ⓟ 08/2009
754761364.013.png 754761364.014.png 754761364.015.png 754761364.016.png 754761364.017.png 754761364.018.png 754761364.019.png 754761364.020.png 754761364.021.png 754761364.022.png 754761364.023.png 754761364.024.png 754761364.025.png 754761364.026.png 754761364.027.png 754761364.028.png 754761364.029.png 754761364.030.png 754761364.031.png 754761364.032.png 754761364.033.png 754761364.034.png 754761364.035.png 754761364.036.png 754761364.037.png 754761364.038.png 754761364.039.png 754761364.040.png 754761364.041.png 754761364.042.png 754761364.043.png 754761364.044.png 754761364.045.png 754761364.046.png 754761364.047.png 754761364.048.png 754761364.049.png 754761364.051.png 754761364.052.png 754761364.053.png 754761364.054.png 754761364.055.png 754761364.056.png 754761364.057.png 754761364.058.png
 
Table of contents
1
VBS for Creating Procedures and Actions.................................................................................................13
1
Resources...................................................................................................................................13
1.1
VBS for Creating Procedures and Actions..................................................................................13
1.2
Using Visual Basic Script in WinCC............................................................................................14
1.3
Modules and Procedures.............................................................................................................18
1.4
Actions.........................................................................................................................................21
1.5
Multiple Use of Procedures and Actions......................................................................................23
1.6
Use of CrossReference...............................................................................................................25
1.7
Using Global Tags in VBS...........................................................................................................27
1.8
VBScript Editors..........................................................................................................................28
1.8.1
VBScript Editors..........................................................................................................................28
1.8.2
Global Script Editor......................................................................................................................30
1.8.3
Working in an Editing Window.....................................................................................................32
1.8.4
Working with the Toolbars...........................................................................................................36
1.8.5
Deleting Actions or Procedures...................................................................................................38
1.9
Creating and Editing Procedures.................................................................................................39
1.9.1
Creating and Editing Procedures.................................................................................................39
1.9.2
Creating a New Procedure..........................................................................................................42
1.9.3
How to Write Procedure Codes...................................................................................................45
1.9.4
Using Standard and Project Procedures.....................................................................................47
1.9.5
Adding Module-related Information.............................................................................................49
1.9.6
Protecting a Module with a Password.........................................................................................51
1.9.7
Saving a Procedure.....................................................................................................................52
1.9.8
Renaming a Procedure or Module...............................................................................................54
1.10 Creating and Editing Actions.......................................................................................................55
1.10.1 Creating and Editing Actions.......................................................................................................55
1.10.2 Creating a New Action.................................................................................................................59
1.10.3 How to Edit Actions.....................................................................................................................61
1.10.4 How to add information to the action...........................................................................................64
1.10.5 Protecting an Action with a Password.........................................................................................66
1.10.6 Saving Actions.............................................................................................................................67
1.10.7 Triggers.......................................................................................................................................69
1.10.7.1 Triggers.......................................................................................................................................69
1.10.7.2 Animation trigger.........................................................................................................................73
1.10.7.3 How to add a trigger of the type "Timer"......................................................................................74
1.10.7.4 How to add a trigger of the type "Tag".........................................................................................76
1.10.7.5 How to change a trigger..............................................................................................................78
1.10.7.6 How to delete a trigger................................................................................................................79
1.10.8
How to Rename an Action...........................................................................................................81
1.11
Activating Global Actions in Runtime...........................................................................................82
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
3
Table of contents
1.12 Diagnostics..................................................................................................................................83
1.12.1 Diagnostics..................................................................................................................................83
1.12.2 GSC Diagnostics.........................................................................................................................84
1.12.2.1 GSC Diagnostics.........................................................................................................................84
1.12.2.2 Inserting the GSC Diagnostics Window into a Picture.................................................................85
1.12.2.3 GSC Diagnostics Attributes.........................................................................................................86
1.12.2.4 GSC Diagnostics Toolbar............................................................................................................86
1.12.3 GSC Runtime..............................................................................................................................87
1.12.3.1 GSC Runtime..............................................................................................................................87
1.12.3.2 Inserting the GSC Runtime Window into a Picture......................................................................88
1.12.3.3 GSC Runtime Attributes..............................................................................................................89
1.12.4 Testing with the Debugger...........................................................................................................90
1.12.4.1 Testing with the Debugger...........................................................................................................90
1.12.4.2 How to Activate the Debugger.....................................................................................................91
1.12.4.3 Principles of Debugging...............................................................................................................93
1.12.4.4 Components of the Microsoft Script Debuggers..........................................................................95
1.12.4.5 Structure of VBScript Files..........................................................................................................97
1.12.4.6 Action and Procedure Names in the Debugger...........................................................................99
1.12.4.7 Selecting a Script for Editing.....................................................................................................100
1.12.4.8 Processing Scripts Step-by-Step...............................................................................................102
1.12.4.9 Setting Breakpoints...................................................................................................................103
1.12.4.10Deleting Breakpoints.................................................................................................................104
1.12.4.11How to Set Bookmarks in Scripts..............................................................................................105
1.12.4.12How to Determine and Modify Tag and Property Values..........................................................106
1.12.4.13Executing Script Commands.....................................................................................................107
1.13
Printing VBScripts......................................................................................................................108
1.14 VBS Reference..........................................................................................................................109
1.14.1 VBS Reference..........................................................................................................................109
1.14.2 Objects and Lists.......................................................................................................................113
1.14.2.1 Objects and Lists.......................................................................................................................113
1.14.2.2 Alarm object...............................................................................................................................115
1.14.2.3 Alarms object (list).....................................................................................................................116
1.14.2.4 AlarmLogs Object......................................................................................................................118
1.14.2.5 DataItem Object.........................................................................................................................119
1.14.2.6 DataLogs Object........................................................................................................................121
1.14.2.7 DataSet-Objekt (List).................................................................................................................122
1.14.2.8 HMIRuntime Object...................................................................................................................125
1.14.2.9 Item Object................................................................................................................................126
1.14.2.10Layer Object..............................................................................................................................127
1.14.2.11Layers Object (Listing)...............................................................................................................129
1.14.2.12Logging Object..........................................................................................................................130
1.14.2.13ProcessValue Object.................................................................................................................131
1.14.2.14ProcessValues Object (List)......................................................................................................132
1.14.2.15Project Object............................................................................................................................133
1.14.2.16ScreenItem Object.....................................................................................................................134
1.14.2.17ScreenItems Object (List)..........................................................................................................138
1.14.2.18Screen Object............................................................................................................................140
1.14.2.19Screens Object (List).................................................................................................................143
1.14.2.20SmartTags Object......................................................................................................................145
1.14.2.21Tag Object.................................................................................................................................146
1.14.2.22Tags Object (List)......................................................................................................................149
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
4
System Manual, 11/2008,
Table of contents
1.14.2.23TagSet Object (List)...................................................................................................................151
1.14.3 Object Types of the ScreenItem Object.....................................................................................152
1.14.3.1 Object Types of the ScreenItem Object.....................................................................................152
1.14.3.2 Standard objects........................................................................................................................154
1.14.3.3 Smart objects.............................................................................................................................182
1.14.3.4 Windows objects........................................................................................................................214
1.14.3.5 Tube objects..............................................................................................................................226
1.14.3.6 Controls.....................................................................................................................................230
1.14.3.7 Customized object.....................................................................................................................273
1.14.3.8 Group.........................................................................................................................................274
1.14.4 Properties..................................................................................................................................276
1.14.4.1 Properties..................................................................................................................................276
1.14.4.2 A................................................................................................................................................276
1.14.4.3 B................................................................................................................................................295
1.14.4.4 C................................................................................................................................................320
1.14.4.5 D................................................................................................................................................350
1.14.4.6 E................................................................................................................................................359
1.14.4.7 F................................................................................................................................................368
1.14.4.8 G................................................................................................................................................386
1.14.4.9 H................................................................................................................................................390
1.14.4.10I..................................................................................................................................................399
1.14.4.11L.................................................................................................................................................405
1.14.4.12M................................................................................................................................................435
1.14.4.13N................................................................................................................................................452
1.14.4.14O................................................................................................................................................455
1.14.4.15P................................................................................................................................................470
1.14.4.16Q................................................................................................................................................487
1.14.4.17R................................................................................................................................................488
1.14.4.18S................................................................................................................................................497
1.14.4.19T................................................................................................................................................530
1.14.4.20U................................................................................................................................................601
1.14.4.21V................................................................................................................................................610
1.14.4.22W...............................................................................................................................................625
1.14.4.23X - Z...........................................................................................................................................630
1.14.5 Methods.....................................................................................................................................638
1.14.5.1 Methods.....................................................................................................................................638
1.14.5.2 Methods A to E..........................................................................................................................639
1.14.5.3 Get methods..............................................................................................................................648
1.14.5.4 Methods H to M.........................................................................................................................686
1.14.5.5 Methods N to R..........................................................................................................................694
1.14.5.6 Methods S to T..........................................................................................................................712
1.14.5.7 Methods U to Z..........................................................................................................................725
1.14.6 Appendix....................................................................................................................................732
1.14.6.1 Error Messages from Database Area........................................................................................732
1.15 Examples of VBScript................................................................................................................734
1.15.1 Examples of VBScript................................................................................................................734
1.15.2 Examples in WinCC...................................................................................................................734
1.15.2.1 Examples in WinCC...................................................................................................................734
1.15.2.2 Example: Accessing objects in Graphics Designer...................................................................735
1.15.2.3 Example: Defining the color of objects......................................................................................736
1.15.2.4 Example: How to Configure Language Changes......................................................................736
1.15.2.5 Example: Deactivating Runtime................................................................................................737
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
5
Zgłoś jeśli naruszono regulamin