Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub xoTest_CustomConfig()
  2.     Dim element
  3.     Dim folder
  4.     Dim regex
  5.    
  6.     Set folder = Application.GetObject("Driver1")  
  7.     Set regex = CreateObject("VBScript.RegExp")
  8.    
  9.     regex.Global = True
  10.     regex.IgnoreCase = True
  11.     regex.Pattern = ".*UPD"
  12.    
  13.     Sweep folder   
  14.    
  15.     For Each element In arrayList
  16.         ' MsgBox element
  17.        
  18.         If (regex.Test( element )) Then
  19.             MsgBox element
  20.         End If
  21.     Next
  22. End Sub
  23.  
  24. Public arrayList
  25. Set arrayList = CreateObject("System.Collections.ArrayList")
  26.  
  27. Sub Sweep( folder )
  28.     Dim obj
  29.        
  30.     For Each obj In folder
  31.         Select Case TypeName( obj )
  32.         Case "IOFolder"
  33.             Sweep obj
  34.         Case "IOTag", "IOBlock"
  35.             arrayList.Add obj.Name
  36.         Case Else
  37.             ' TODO:
  38.         End Select
  39.     Next
  40.    
  41. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement