3

我有这个 VBS 代码,它就像一个魅力,但由于 Chrome 不支持 VB 脚本。

我需要找到自动热键的替代方法。

如果不只是其中的一部分,有人可以帮我将这段代码转换为 AutoHotKey。

Here is part of code我需要在 AutoHotKey 中做

  With IE.Document
    .getElementByID("login_username").value = "myuser"
    .getElementByID("login_password").value = "mypass"
    .getElementByID("frmLogin").submit
  End With

这是完整代码

WScript.Quit Main

Function Main
  Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
  IE.Visible = True
  IE.Navigate "http://desistream.tv/en/index.shtml"
  Wait IE
  With IE.Document
    .getElementByID("login_username").value = "myuser"
    .getElementByID("login_password").value = "mypass"
    .getElementByID("frmLogin").submit
  End With
End Function

Sub Wait(IE)
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy 
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy 
End Sub

Sub IE_OnQuit
  On Error Resume Next
  WScript.StdErr.WriteLine "IE closed before script finished."
  WScript.Quit
End Sub
4

1 回答 1

3
#SingleInstance, force
#NoEnv
OnExit, ExitSub

IE := ComObjCreate("InternetExplorer.Application")
IE.Visible := true
IE.Navigate("http://desistream.tv/en/index.shtml")

Wait(IE)

pDoc := IE.document

pDoc.getElementByID("username").value := "myuser"
pDoc.getElementByID("pass").value := "mypass"
pDoc.all.frmLogin.submit()

return


+Esc::  ;shift + esc
ExitSub:
try
        IE.Quit
        IE := ""
Exitapp

Wait(IE) {
while IE.readyState!=4 || IE.document.readyState != "complete" || IE.busy
 sleep 10
}

我想就是这样

希望能帮助到你

于 2013-06-26T22:28:15.197 回答