|
原帖由 木卫十二 于 2007-11-1 18:15 发表
Dim res, WSH
Set WSH = CreateObject("WScript.Shell")
res = WSH.Popup("Closed after 2 seconds.", 2) '代替msgbox "Closed after 2 seconds"
Set WSH = Nothing
不是用msgbox了
很好。我试验了一下,基本上可以说成功了。但是还有一个问题就是,如果你这段代码没有跟上一个Msgbox的话,在运行时会报错误。
我在下面这段代码前加了这段代码,就没有出错。
Dim i
Dim res,WSH
Set WSH=Createobject("WScript.Shell")
Set Msg=Description.create()
For i=1 to 4
If (i=2) or (i=4) Then
MyMessage=MsgBox("Hello Morgan.D,",vbOK) 就是这段代码,添加后,就不会报错了。如果不添加,则要象下列抓拍图一样报错。
res = WSH.Popup("Closed after 2 seconds.", 2) '代替msgbox "Closed after 2 seconds"
Set WSH = Nothing
else
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set "admin"
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").Type "MERCURY"
Dialog("Login").WinEdit("Password:").SetSecure "472ff7785a1452302b5089fbd42d83c7c005d116"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"
'**********************************************
MyMessage=MsgBox("Hello Morgan.D,",65,"MsgBox Example")
msg("text").value="MsgBox Example"
dialog(msg).close
'*******************************************
End If
Next
[ 本帖最后由 madwolfer 于 2007-11-6 14:06 编辑 ] |
|