houna305 发表于 2004-8-9 15:03:32

求助:robot 如何进行循环?

Sub Main
    Dim Result As Integer

    'Initially Recorded: 2004-8-911:59:48
    'Script Name: jiaoseshanchu
   
    Window SetContext, "Caption=http://192.168.102.252:7001/adm/welcome.jsp - Microsoft Internet Explorer", ""
    Browser SetFrame,"Type=HTMLFrame;HTMLId=mainFrame",""
    Browser NewPage,"HTMLTitle=角色管理",""
   
    HTMLLink Click, "Type=HTMLLink;HTMLText=229", ""
    PushButton Click, "Type=PushButton;Name=delete"
   
    Window SetContext, "Caption=Microsoft Internet Explorer", ""
    PushButton Click, "Text=确定"
   

End Sub
上面是删除id号为229的记录,若我想删除229-240号的记录,如何进行循环操作呢,谢谢各位大侠了。。。。。。。。。。。。

小颖_hlj 发表于 2004-8-9 16:38:51

循环

可以将要删除的id号定义 为变量,利用for循环语句,使变量自动增加,形成循环就行了
定义id号变量dimid as integer
定义循环变量 dim i as integer
把你执行脚本放在for循环中,可以实现循环回放
将HTMLLink Click, "Type=HTMLLink;HTMLText=229", ""
229 换成 id   
别忘了 把id加1

houna305 发表于 2004-8-10 10:20:42

小颖_hlj,你看我这个循环可以么,怎么还是还是执行不下去呢,你可别笑我笨哦 ,新手上路,大家多多指点
id=234

   do
   
   HTMLLink Click, "Type=HTMLLink;HTMLText=id", ""
   PushButton Click, "Type=PushButton;Name=delete"

   id=id+1
   loopwhile id<237
   
    Window SetContext, "Caption=Microsoft Internet Explorer", ""
    PushButton Click, "Text=确定"

End Sub

yxueming 发表于 2004-8-12 09:04:35

For id=229 to 240
       Browser NewPage,"HTMLTitle=角色管理",""
      HTMLLink Click, "Type=HTMLLink;HTMLText=" & cstr(id),""
      PushButton Click, "Type=PushButton;Name=delete"
   
    Window SetContext, "Caption=Microsoft Internet Explorer", ""
    PushButton Click, "Text=确定"

Next   
没看到你的程序,可能for 循环嵌套位置要有所调整

houna305 发表于 2004-8-12 10:08:15

问题已经解决了, 谢谢大家

zjviolet 发表于 2004-9-17 14:49:25

我录的是这样的,就是删除一条记录的操作,要怎么样让他循环多次呢。

   sub main
    'Initially Recorded: 2004-9-1713:32:17
    'Script Name: 1

    Window SetContext, "Caption=Newtouch ONE! - Microsoft Internet Explorer", ""
    Browser SetFrame,"Type=HTMLFrame;HTMLId=Main_frame",""
    HTMLTable Click, "Type=HTMLTable;Index=3", "Row=2;Col=5"
    Browser NewPage,"",""
    PushButton Click, "Type=PushButton;Name=delB"
   
    Window SetContext, "Caption=Microsoft Internet Explorer", ""
    PushButton Click, "Text=确定"


    End Sub
页: [1]
查看完整版本: 求助:robot 如何进行循环?