即时消息-两端脚本互通,增加“收到”消息
上一篇 /
下一篇 2011-03-18 11:15:59
/ 个人分类:QTP学习
两端聊天时,需要脚本同步内容,此时,可设置一“收到”内容控制双方脚本同步。
本端脚本:
rowcount=datatable.GetSheet(dtGlobalSheet).GetRowCount
For j=1 to rowcount
datatable.GetSheet(dtGlobalSheet).SetCurrentRow(j)
s2=Dialog("Lemon").WinObject("WinObject_2").GetROProperty("text",value)
sr=split( s2,vbCrLf)
While sr(ubound(sr)-1) <>"收到"
wait 2
s2=Dialog("Lemon").WinObject("WinObject_2").GetROProperty("text",value)
sr=split( s2,vbCrLf)
Wend
Dialog("Lemon").WinObject("WinObject").Type DataTable("发送内容", dtGlobalSheet)
Dialog("Lemon").WinObject("WinObject").Type micReturn
CheckSMSReceipt()
Next
'发送“完毕”短信通知对方。
Dialog("Lemon").WinObject("WinObject").Type "完毕"
Dialog("Lemon").WinObject("WinObject").Type micReturn
对端脚本:
rowcount=datatable.GetSheet(dtGlobalSheet).GetRowCount
For k=1 to rowcount
datatable.GetSheet(dtGlobalSheet).SetCurrentRow(k)
'若聊天对话框中内容为”收到“,则等待。
s2=Dialog("Lemon").WinObject("WinObject").GetROProperty("text",value)
sr=split( s2,vbCrLf)
msgbox s2
While sr(ubound(sr)-1)="收到"
wait 2
s2=Dialog("Lemon").WinObject("WinObject").GetROProperty("text",value)
sr=split( s2,vbCrLf)
Wend
'若消息为“完毕”则跳出循环,否则核对消息内容,发送“收到”给对端。
If sr(ubound(sr)-1)="完毕" Then
Reporter.ReportEvent micDone,"收到“完毕”短信,发送结束",""
Exit for
else
CheckSMSReceipt()
Dialog("Lemon").WinObject("WinObject_2").Type "收到"
Dialog("Lemon").WinObject("WinObject_2").Type micReturn
End If
Next
收藏
举报
TAG: