Dim Dept1
Set Dept1 = Description.Create
Dept1("text").value = ".*门诊"
Dept1("html tag").value = "A"
Dept1("visible").value = True
Set DDept1 = Browser("****").Page("****").ChildObjects(Dept1)
End Function
Function D2(DDept2)
Dim Dept2
Set Dept2 = Description.Create
Dept2("text").value = ".*科"
Dept2("html tag").value = "A"
Dept2("visible").value = True
Set DDept2= Browser("****").Page("****").ChildObjects(Dept2)
End Function
Function D3(DDept3)
Dim Dept3
Set Dept3 = Description.Create
Dept3("text").value = ".*专家"
Dept3("html tag").value = "A"
Dept3("visible").value = True
Set DDept3= Browser("****").Page("****").ChildObjects(Dept3)
End Function
Function D4(DDept4)
Dim Dept4
Set Dept4 = Description.Create
Dept4("text").value = ".*\(.*\)"
Dept4("html tag").value = "A"
Dept4("visible").value = True
Set DDept4= Browser("****").Page("****").ChildObjects(Dept4)
End Function
Sub DDept()
Dim j
Dim keshi1
Dim keshi2
Dim keshi3
Dim keshi4
Call D1(Ddept1) '以“门诊”结尾的科室
keshi1=Ddept1.Count
Call D2(Ddept2) '以“科”结尾的科室
keshi2=Ddept2.Count
Call D3(Ddept3) '以“专家”结尾的科室
keshi3=Ddept3.Count
Call D4(Ddept4) '以“()”结尾的科室
keshi4=Ddept4.Count
If not keshi1>0 Then
If not keshi2>0 Then
If not keshi3>0 Then
keshi4=keshi4-1
Randomize
j=Int(((keshi4 - 0 + 1) * Rnd) + 0) ' Generate random value between 0 and keshi4
Ddept4(j).Click
else
keshi3=keshi3-1
Randomize
j=Int(((keshi3 - 0 + 1) * Rnd) + 0) ' Generate random value between 0 and keshi3
Ddept3(j).Click
End If
keshi2=keshi2-1
Randomize
j=Int(((keshi2 - 0 + 1) * Rnd) + 0) ' Generate random value between 0 and keshi2
Ddept2(j).Click
End If
else
keshi1=keshi1-1
Randomize
j=Int(((keshi1 - 0 + 1) * Rnd) + 0) ' Generate random value between 0 and keshi1
Ddept1(j).Click