I saved your html as an htm file, opened it in Internet Explorer, and tried the following code on it. It can easily be adjusted to work with a HTMLFile object: to use the oHTML approach, replace 'oWB.document' with 'oHTML'. Your table uses input fields, which is not something I'd tested code on before, however, I managed to figure something out by trial and error.
Code: Select all
q:: ;Internet Explorer - table get text
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
;MsgBox, % oWB.document.getElementsByTagName("table").length
oTable := oWB.document.getElementsByTagName("table")[0]
oRows := oTable.rows
vOutput := ""
;MsgBox, % oRows.length
;note: the html has two elements with same ID '_fdto'
MsgBox, % oWB.document.getElementById("_fdto").value
Loop % oRows.length
{
oCells := oRows[A_Index-1].cells
;MsgBox, % oCells.length
Loop, % oCells.length
{
if oCells[A_Index-1].all.length
{
vTemp := ""
try vTemp := oCells[A_Index-1].getElementsByTagName("input")[0].value
vOutput .= vTemp "`t"
}
else
vOutput .= oCells[A_Index-1].innerText "`t"
}
vOutput := SubStr(vOutput, 1, -1) "`r`n"
}
oWB := oTable := oRows := oCells := ""
MsgBox, % Clipboard := vOutput
return
Link:
[see 'TABLES: GET TEXT FROM CELLS' section]
jeeswg's Internet Explorer and HTML tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=31766