我正在尝试创建一个脚本,该脚本检查内部网站上是否有可用的许可证,并向用户报告消息提示(如果有或没有可用的许可证)。网站搜索工作正常,但是,我无法正确设置第二条消息提示的格式。 如果我发送命令以搜索“已使用5个许可证”,我希望收到一条消息,提示没有可用的许可证。如果该值不匹配,则表明有可用的许可证。
如有必要,可以重写整个脚本。不必是循环。只需要这个工作功能。
Do
Find "5 Licenses used","websiteaddress.com"
Pause("60")'waiting for 60 minutes and repeat the action
Loop
Function Find(StrString,URL)
Title = "License Check"
'URL = "Websiteaddress.com"
Set ie = CreateObject("InternetExplorer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
ie.Navigate(URL)
ie.Visible = false 'run ie in the background
Do While ie.Busy
WScript.Sleep 100
Loop
Data = ie.document.documentElement.innertext
Set ie = Nothing
Set objRegex = New RegExp
objRegex.Pattern = StrString
objRegex.Global = False
objRegex.IgnoreCase = True
Set Matches = objRegex.Execute(Data)
For Each Match in Matches
MsgBox "There Are Currently No Licenses Available " & URL, 64, Title
Next
If
'No Match in Matches
MsgBox "There Are Licenses Available " & URL, 64, Title
End If
End Function
Function qq(strIn)
qq = Chr(34) & strIn & Chr(34)
End Function
Function Pause(NbMin)
WScript.Sleep NbMin*1000*60
End Function
答案 0 :(得分:0)
计算比赛次数。
If Matches.Count > 0 Then
MsgBox "There Are Currently No Licenses Available " & URL,64,Title
Else
MsgBox "There Are Licenses Available " & URL, 64,Title
End If