【问题标题】:How can I focus and autofill a text field in Autohotkey?如何在 Autohotkey 中聚焦和自动填充文本字段?
【发布时间】:2017-08-29 18:02:49
【问题描述】:

我正在尝试编写一个脚本来使用 AutoHotkey 脚本自动用当前日期填充网络字段。但是,我不确定如何通过 nameid 来关注特定字段。

我目前的解决方法是使用Send, {Tab 84} 滚动到特定字段,使用Send, 6/28/2017 键入日期,然后手动提交该字段。虽然该脚本大部分时间都有效,但显然还有更好的方法。

如何使用 AutoHotkey 脚本将自动填充特定文本字段集中在网页上?

【问题讨论】:

  • 如果特定字段没有改变其在网页上的位置,您可以使用 Click 或 ControlClick 命令。更好的选择是 ControlSend 或 ControlFocus,但我怀疑 Autohotkey 可以识别网页上的任何编辑控件。
  • 找到一个可能的(未答复的)重复项:Find and fill an input field with AutoHotKey

标签: web-scraping autohotkey


【解决方案1】:

IE COM 对象应该可以解决问题,只要您能够使用自己的 JS 轻松导航 DOM。

这是一个例子:

F3::
wb := ComObjCreate("InternetExplorer.Application") ; Create a IE instance
wb.Visible := True
wb.Navigate("http://google.com")
Sleep, 5000
SendInput, This is test.{Enter}
Sleep, 5000
wb.document.getElementById("lst-ib").value := "This is another test."
wb.document.getElementById("_fZl").click()
return

【讨论】:

    猜你喜欢
    • 2021-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多