Item Method
Function
Retrieves an object from a collection and enables access to it via Index.
Description of DataItem Object
Access uses the name under which the value was added to the list. Single access using an
index is not recommended since the index changes during adding or deleting of values.
syntax
Expression.Item()
Expression
Necessary. An expression which returns an object of the type "Screens", "Layers" (or "Tags").
NOTICE
In the case of "Tags", restricted functional scope! The standard methods get_Count and
get_NewEnum are missing so that access via Index nor the counting of all tags is possible.
Parameters
VARIANT
Example:
The following example issues the names of all objects contained in the picture "NewPDL1":
'VBS99
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'The objects will be indicate by Item()
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
lngAnswer = MsgBox(objScrItem.ObjectName, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
687