51Testing软件测试论坛

标题: 怎么实现不了循环 [打印本页]

作者: apple69    时间: 2007-1-26 11:53
标题: 怎么实现不了循环
Sub Main
    Dim Result,i As Integer

    'Initially Recorded: 2007-1-26  11:23:12
    'Script Name: 11
     i=1
    if  i<=6 then
    Window SetContext, "Caption=Program Manager", ""
    ListView DblClick, "Text=FolderView;\;ItemText=服务", "Coords=32,54"
    Window SetContext, "Type=Form;Name=FrmServer", ""
    PushButton Click, "Type=PushButton;Name=btnClose"
    i=i+1
    end if
End Sub
作者: sidneylover    时间: 2007-1-26 13:43
if只起到了个判断作用,用while或for语句来实现循环
while i<=6
  Window SetContext, "Caption=Program Manager", ""
    ListView DblClick, "Text=FolderView;\;ItemText=服务", "Coords=32,54"
    Window SetContext, "Type=Form;Name=FrmServer", ""
    PushButton Click, "Type=PushButton;Name=btnClose"
    i=i+1
wend
作者: rivermen    时间: 2007-1-28 22:02
看来编程的流程结构方面知识需要加强!!!
作者: xzxu    时间: 2007-1-29 23:34
可以用 for 语句实现循环
修改后程序如下 :
-------------------------------------------------

Sub Main
    Dim Resulti As Integer

    Dim n

    for n = 1 to 6

    Window SetContext, "Caption=Program Manager", ""
    ListView DblClick, "Text=FolderView;\;ItemText=服务", "Coords=32,54"
    Window SetContext, "Type=Form;Name=FrmServer", ""
    PushButton Click, "Type=PushButton;Name=btnClose"

next

End Sub




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2