Autohotkey 如何使用IE通过AHK将按钮插入网页

Autohotkey 如何使用IE通过AHK将按钮插入网页,autohotkey,Autohotkey,我正在尝试使用IE和AHK将一个按钮插入页面上的div中 这就是我所拥有的: SetTitleMatchMode, 2 wb := IEGet("Page1") wb.document.all.external.innerText := "<input type=""button"" value=""Click Me!"" />" IEGet(Name="") ;Retrieve pointer to existing IE window/tab { If

我正在尝试使用IE和AHK将一个按钮插入页面上的div中

这就是我所拥有的:

SetTitleMatchMode, 2

wb := IEGet("Page1")
wb.document.all.external.innerText := "<input type=""button"" value=""Click Me!"" />"


IEGet(Name="")        ;Retrieve pointer to existing IE window/tab
{
    IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame
    {
        Name := ( Name="New Tab - Windows Internet Explorer" ) ? "about:Tabs" : RegExReplace( Name, " - (Windows|Microsoft) Internet Explorer" )
    }

    For wb in ComObjCreate( "Shell.Application" ).Windows
    {
        If ( wb.LocationName = Name ) && InStr( wb.FullName, "iexplore.exe" )
        {
            Return wb
        }
    }
}
div的id为external。我用的是IE 11,Win 8.1和AHK 1.1.19.01。页面标题为第1页

当我运行上面的脚本时,我没有得到一个按钮,但是我得到一个按钮的html文本。显然,将<和>转换为相关实体


我怎样才能得到一个按钮呢?

没关系,我想出来了。这更像是一个IE DOM问题,而不是一个AHK问题

这是如何做到的:

wb := IEGet("Page1")

inp := wb.document.createElement("input")
typ := wb.document.createAttribute("type")
typ.value := "button"
val := wb.document.createAttribute("value")
val.value := "Click Me!"
inp.setAttributeNode(typ)
inp.setAttributeNode(val)

wb.document.all.external.appendChild(inp)