为了账号安全,请及时绑定邮箱和手机立即绑定

如何使用 VBScript 从下拉列表中设置选项

如何使用 VBScript 从下拉列表中设置选项

摇曳的蔷薇 2022-09-11 20:32:06
我的目标是超级简单,我只想用.vbs填充一个网页,我几乎做了所有,只留下下拉列表我用了:Document.All.Item("CamposTrat[0]").Value = "FINALIZADO"但两者都不起作用。Document.All.Item("CamposTrat[0]").SelectedIndex = 1几乎工作了,它用蓝色选择“选项”最后定稿“(示例&html代码),但没有将”最后定稿“设置为屏幕上的”值“。感觉就像是缺少按“输入”进行确认。.SelectedIndex = 1我只想把“最后”,而无需点击或使用。我想要一个漂亮的代码:D"SendKeys{"FINALIZADO"}"PS:我不太了解爪哇/虚拟脚本。我还不知道如何配置这些类型的代码。如果有人可以发送“完整”代码,那将很有帮助。
查看完整描述

2 回答

?
慕码人2483693

TA贡献1860条经验 获得超9个赞

3个月后,我到达了美丽的代码kkk:


Dim sh

Dim WS

Dim IE

Dim Produto

Dim Index

Dim Motivo

Dim Obs


Set sh = CreateObject("Shell.Application")

Set WS = CreateObject("WScript.Shell")


For Each wnd In sh.Windows

   If InStr(1, wnd.FullName, "iexplore.exe", vbTextCompare) > 0 Then

      Set IE = wnd

      Exit For

   End If

Next


With IE.Document.All

   If .Item("CamposProtocolo[8].Descricao").Value = "Plano de voz" or .Item("CamposProtocolo[8].Descricao").Value = "Após Horário Atendimento" Then

      Produto = "MÓVEL"

   Else

      Produto = .Item("CamposProtocolo[8].Descricao").Value

   End if


   If .Item("CamposProtocolo[7].Descricao").Value = "Cancelamento Total" or .Item("CamposProtocolo[7].Descricao").Value = "Cancelamento Parcial" Then

      Index  = 20

      Motivo = "OI CONTA TOTAL / OI TOTAL"

      Obs    = "Móvel e Oi Total cancelados - aguardando conclusão da OS." & Chr(13) & "- Sem acesso a cancelamento/migração R2 -"

   Else

      Index  = 26

      Motivo = "STATUS SUSPENSO"

      Obs    = "Sem acesso a " & Chr(13) & "- Nenhuma alteração realizada -"

   End if

End With


If MsgBox(" Finalizado? ", vbYesNo + vbQuestion, "Powered by Alexan") = vbYes Then

   With IE.Document.All

      .Item("CamposTrat[0]").SelectedIndex          = 1

      .Item("select2-28796-container").InnerText    = "FINALIZADO"

      .Item("CamposTrat[1]").SelectedIndex          = 23

      .Item("select2-28797-container").InnerText    = "SOLICITAÇÃO ATENDIDA"

      .Item("CamposTrat[2]").Value                  = Produto

      .Item("CamposTrat[3]").Value                  = "BO RETENÇÃO EMPRESARIAL"

      .Item("CamposTrat[4]").Value                  = "CANCELADO"

      .Item("CamposTrat[5]").Value                  = .Item("CamposProtocolo[1].Descricao").Value

      .Item("CamposTrat[6]").Value                  = "0"

      .Item("CamposTrat[7]").Value                  = "0"

      .Item("CamposTrat[8]").Value                  = "-"

      .Item("CamposTrat[9]").Value                  = .Item("CamposProtocolo[14].Descricao").Value

      .Item("CamposTrat[10]").Value                 = "00.000.000/0000-00"

      .Item("CamposTrat[11]").Value                 = .Item("CamposProtocolo[1].Descricao").Value

      .Item("CamposTrat[12]").Value                 = "1"

      .Item("CamposTrat[13]").SelectedIndex         = 1

      .Item("select2-28809-container").InnerText    = "NÃO"

      .Item("Status").SelectedIndex                 = 2

      .Item("select2-Status-container").InnerText   = "Finalizado"

      .Item("Observacao").Value                     = "Protocolo perfilado com sucesso!"

   End With


   IE.Visible = True

   WS.AppActivate "Tratar Protocolos - Internet Explorer"

   IE.Document.All.Item("Observacao").Focus

   WS.SendKeys "^{a}"


ElseIf MsgBox("  Pendente?   ", vbYesNo + vbQuestion, "Powered by Alexan") = vbYes Then

   With IE.Document.All

      .Item("CamposTrat[0]").SelectedIndex          = 4

      .Item("select2-28796-container").InnerText    = "PENDENTE"

      .Item("CamposTrat[1]").SelectedIndex          = Index

      .Item("select2-28797-container").InnerText    = Motivo

      .Item("CamposTrat[2]").Value                  = "FIXO + BL"

      .Item("CamposTrat[3]").Value                  = "BO RETENÇÃO EMPRESARIAL"

      .Item("CamposTrat[4]").Value                  = "DESMEMBRADO"

      .Item("CamposTrat[5]").Value                  = .Item("CamposProtocolo[1].Descricao").Value

      .Item("CamposTrat[6]").Value                  = "0"

      .Item("CamposTrat[7]").Value                  = "0"

      .Item("CamposTrat[8]").Value                  = "-"

      .Item("CamposTrat[9]").Value                  = .Item("CamposProtocolo[14].Descricao").Value

      .Item("CamposTrat[10]").Value                 = "00.000.000/0000-00"

      .Item("CamposTrat[11]").Value                 = .Item("CamposProtocolo[1].Descricao").Value

      .Item("CamposTrat[12]").Value                 = "0"

      .Item("CamposTrat[13]").SelectedIndex         = 1

      .Item("select2-28809-container").InnerText    = "NÃO"

      .Item("Status").SelectedIndex                 = 4

      .Item("select2-Status-container").InnerText   = "Pendente"

      .Item("Observacao").Value                     = Obs

   End With


   WS.AppActivate "Tratar Protocolos - Internet Explorer"

   IE.Document.All.Item("Observacao").Focus

   WS.SendKeys "{UP}"

   WS.SendKeys "{END}"

End if


查看完整回答
反对 回复 2022-09-11
?
波斯汪

TA贡献1811条经验 获得超4个赞

答案是:

IE.Document.All.Item("select2-37536-container").InnerText = "FINALIZADO"  
IE.Document.All.Item("CamposTrat[0]").SelectedIndex = 1


查看完整回答
反对 回复 2022-09-11
  • 2 回答
  • 0 关注
  • 365 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号