wsryyffs 发表于 2006-5-23 20:09:53

goto语句的问题

如下是脚本,我goto到password:,运行不了,提示"playback in progress...waiting for window"
'$Include "common.sbh"
'$Include "dbOper.sbh"
Sub Main
    Dim Result As Integer
   
    Dim vn_flag As Integer

    'Initially Recorded: 2006-5-2316:50:26
    'Script Name: gsm_改号_3
    '弹出对话框的内容
    Dim Dialogstr As string
    '取操作员返回信息的数据串
    Dim Opernamestr As string
   
    '从数据库取出城市和受理点
    Dim arry_opername(1 To 2, 1 To 2)As Variant
   
   '从数据库取出密码验证号码
    Dimvs_service_id(1 To 2, 1 To 1)As Variant
   
    '数据库表信息的返回状态
    Dim dbresult as long
   
    '密码
    Dim vs_password As string
   

    StartBrowser "http://172.20.24.5:9001", "WindowTag=WEBBrowser"
   
    Window SetContext, "Caption=输入网络密码", ""
   
    '获取操作员工号Opernamestr
    Result=SQAGetProperty("\;Type=Window;Caption=输入网络密码;\;Type=EditBox;Label=用户名(U)","Text",Opernamestr)
    if Result<>0 then
    SQALogMessage sqaFail,"取操作员返回信息失败","取返回信息!"
    'msgbox(Result)
    Exit Sub
    else
    SQALogMessage sqaPass,"操作员返回信息:"+Opernamestr,"认证通过!"
    end if
   
    PushButton Click, "Text=确定"
   
    '获取操作员的city_code,department
    dbresult=globalQuery("hbbus","unitele","lemontea","select city_code,department from bm_person_name_t where lower(account)= "+"'"+Opernamestr+"'",arry_opername)
    'msgbox(dbresult)
    if dbresult<0 then
    'msgbox(dbresult)
    SQALogMessage sqaFail,"连接数据库失败","连接数据库失败!"
    Exit Sub
    end if
   
    '调试语句,输出city_code,department
    'msgbox(arry_opername(1,1))'city_code
    'msgbox(arry_opername(2,1))'department
   
    '获取密码验证号码
   
    dbresult=globalQuery("hbbus","unitele","lemontea","select service_id,password from bb_service_relation_t where city_code="+arry_opername(1,1)+" and service_kind=9 and if_valid=1 and serving_status=1 and PRESERVE12=0 and preserve02<>3 and service_id not in ('13088990001','13304110026') and rownum=1",vs_service_id)
    'msgbox(dbresult)
    if dbresult<0 then
    'msgbox(dbresult)
    SQALogMessage sqaFail,"连接数据库失败","连接数据库失败!"
    Exit Sub
    else
    SQALogMessage sqaPass,"改号前号码:"+vs_service_id(1,1),"查询时弹出信息!"
    end if
   
    '调试语句,输出vs_service_id
    'msgbox(vs_service_id(1,1))'密码验证号码
    'msgbox(vs_service_id(2,1))'密码
   
    vs_password="888888"
    vn_flag=1
    Window SetContext, "WindowTag=WEBBrowser", ""
    Window WMaximize, "", ""

    Browser SetFrame,"Type=HTMLFrame;HTMLId=left_page",""
    Browser NewPage,"",""   
    HTML Click, "Type=HTML;HTMLId=GSM改号", "Coords=31,7"
    Browser SetFrame,"Type=HTMLFrame;HTMLId=right_page;\;Type=HTMLFrame;HTMLId=header",""
    Browser NewPage,"HTMLTitle=GSM改号;Index=0",""
    EditBox Click, "Type=EditBox;Name=TPhoneNumber", "Coords=22,7"
    InputKeys vs_service_id(1,1)
    EditBox Click, "Type=EditBox;Name=TPassword", "Coords=38,14"
    DelayFor (1000)
password:   
    if vn_flag=1 then
    InputKeys "{BKSP}{BKSP}{BKSP}{BKSP}{BKSP}{BKSP}"
    end if
    InputKeys vs_password'"CQAAAKQAAABdVOtDjKE5HA0="
    PushButton Click, "Type=PushButton;Name=Bquery"
   
    'Window SetContext, "Caption=Microsoft Internet Explorer", ""
    'PushButton Click, "Text=确定"
   
    DelayFor (1000)
refetch:
    Result=SQAGetProperty("\;Type=Window;Caption=Microsoft Internet Explorer;\;Type=Label;ObjectIndex=1","Text",Dialogstr)
    if Result=0 and instr(Dialogstr,"欠费")then
      Window SetContext, "Caption=Microsoft Internet Explorer", ""
      PushButton Click, "Text=确定"
      
      SQALogMessage sqaPass,"欠费验证通过!"+Dialogstr,"欠费验证通过!"
         goto refetch
   elseif Result=0 and instr(Dialogstr,"密码不正确")then
   Window SetContext, "Caption=Microsoft Internet Explorer", ""
      PushButton Click, "Text=确定"
   SQALogMessage sqaPass,"密码验证通过!"+Dialogstr,"密码验证通过!"
         
         vs_password=vs_service_id(2,1)
         goto password
   else
      SQALogMessage sqaFail,"密码验证不通过!","密码验证不通过!"
   
    end if
   
   
   
   

End Sub

wsryyffs 发表于 2006-5-24 07:26:34

已经解决
页: [1]
查看完整版本: goto语句的问题