Dim text
text = ""
Dim rgx
Set rgx = New RegExp
rgx.IgnoreCase = True
rgx.Global = True
rgx.Pattern = "([A-Za-z]{3,9})://([-;:&=\+\$ ,\w]+@{1})?([-A-Za-z0-9\.]+)+: ?(\d+)?((/[-\+~%/\.\w]+)?\??([ -\+=&;%@\.\w]+)?#?([\w]+)?)?"
Dim match, matches
Set matches = rgx.Execute(text)
For Each match in matches
MsgBox match.Value, 0, "Found Match"
Next
'Launch a notepad window
SystemUtil.Run "notepad.exe"
'Close the window just launched using the exact title
SystemUtil.CloseProcessByWndTi tle "Untitled - Notepad"
'Launch a notepad window
SystemUtil.Run "notepad.exe"
'Close the window just launched using a pattern string
SystemUtil.CloseProcessByWndTi tle ".*Notepad", True
SystemUtil.CloseDescendentProc esses
CloseDescendentProcesses can be used to close any process launched by QTP. The code below illustrates the usage
'Launch explorer
SystemUtil.Run "iexplore.exe"
'Launch excel using COM
Set oXL = CreateObject("Excel. Application")
oXL.Visible = True
'Close processes launched by QTP. This will close
'the internet explorer and Excel as well
SystemUtil.CloseDescendentProc esses
While Browser("creationtime:=0").Exi st(0)
'Close the browser
Browser("creationtime:=0").Clo se
text = "
Dim rgx
Set rgx = New RegExp
rgx.IgnoreCase = True
rgx.Global = True
rgx.Pattern = "([A-Za-z]{3,9})://([-;:&=\+\$
Dim match, matches
Set matches = rgx.Execute(text)
For Each match in matches
MsgBox match.Value, 0, "Found Match"
Next
'Launch a notepad window
SystemUtil.Run "notepad.exe"
'Close the window just launched using the exact title
SystemUtil.CloseProcessByWndTi
'Launch a notepad window
SystemUtil.Run "notepad.exe"
'Close the window just launched using a pattern string
SystemUtil.CloseProcessByWndTi
SystemUtil.CloseDescendentProc
CloseDescendentProcesses can be used to close any process launched by QTP. The code below illustrates the usage
'Launch explorer
SystemUtil.Run "iexplore.exe"
'Launch excel using COM
Set oXL = CreateObject("Excel.
oXL.Visible = True
'Close processes launched by QTP. This will close
'the internet explorer and Excel as well
SystemUtil.CloseDescendentProc
While Browser("creationtime:=0").Exi
'Close the browser
Browser("creationtime:=0").Clo
Post a Comment