Function RegExpTest(patrn, strng)
Dim regEx, retVal
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = False
regEx.Global = True
retVal = regEx.Test(strng)
If retVal Then
RegExpTest = True
Else
RegExpTest = False
End If
End Function
MyOS = Split(Environment.Value ("OS"), " ", -1, 1)
For i = 0 To Ubound(MyOS)
msgbox MyOS(i)
If (strcomp(MyOS(i),2000) = 0) Then
SystemDisk = Left (Environment.Value ("SystemTempDir"),3)&"WINNT/system32/"
Else
SystemDisk = Left (Environment.Value ("SystemTempDir"),3)&"WINDOWS/system32/"
End If
Next
SystemUtil.Run SystemDisk&"taskmgr.exe","",SystemDisk,"open"
Set mainwin= Description.Create( )
AppNo = Dialog("regexpwndtitle:=Windows Task Manager").WinListView("regexpwndtitle:=Tasks").GetItemsCount
For App_i = 0 To AppNo-1
AppName = Dialog("regexpwndtitle:=Windows Task Manager").WinListView("regexpwndtitle:=Tasks").GetItem(App_i)
If RegExpTest("Bug.",AppName) Then
Msgbox "Find"
Else
Msgbox "Don't Find"
End If
Next
'###########################################
Dim mainwin
Set mainwin= Description.Create( )
mainwin("name").value="SchoolManage"
set children = desktop.ChildObjects(mainwin)
If children.Count = 1 Then
CheckObjectDesription = "Object Unique"
ElseIf children.Count = 0 Then
CheckObjectDesription = "Object Not Found"
Else
CheckObjectDesription = "Object Not Unique"
End If
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:/StudentID.txt", ForReading, True)
While (f.AtEndOfLine <> True)
str = f.ReadLine
If RegExpTest("13008/d/d/d3", str) Then
MsgBox str
End If
Wend
f.Close
'############################################################
Function FindAppInTM(patrn)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = False
regEx.Global = True
MyOS = Split(Environment.Value ("OS"), " ", -1, 1)
For i = 0 To Ubound(MyOS)
If (strcomp(MyOS(i),2000) = 0) Then
SystemDisk = Left (Environment.Value ("SystemTempDir"),3)&"WINNT/system32/"
Else
SystemDisk = Left (Environment.Value ("SystemTempDir"),3)&"WINDOWS/system32/"
End If
Next
SystemUtil.Run SystemDisk&"taskmgr.exe","",SystemDisk,"open"
Set mainwin= Description.Create( )
AppNo = Dialog("regexpwndtitle:=Windows Task Manager").WinListView("regexpwndtitle:=Tasks").GetItemsCount
For App_i = 0 To AppNo-1
AppName = Dialog("regexpwndtitle:=Windows Task Manager").WinListView("regexpwndtitle:=Tasks").GetItem(App_i)
If regEx.Test( AppName) Then
FindAppInTM = True
Else
FindAppInTM = False
End If
Next
Dialog("regexpwndtitle:=Windows Task Manager").Close
End Function