Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Created April 22, 2021 20:31
Show Gist options
  • Save JoeGlines/0bee790f052ba55be5cb994fa8cfa435 to your computer and use it in GitHub Desktop.
Save JoeGlines/0bee790f052ba55be5cb994fa8cfa435 to your computer and use it in GitHub Desktop.
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
#SingleInstance,Force
pwb := WBGet() ;Get handle to IE Page
;~ MsgBox % pwb.document.getElementsbyTagName("Table")[0].InnerText
;*********** loop over table*****Maestrith helped significantly with the listview portion*******
pwb := WBGet() ;connect to current IE window (Make sure WBGet function is in your library or this script)
Gui,DD:destroy
loop, % Pwb.Document.All.Tags("TABLE").length ;get count of all tables on page
Table_List.=A_index-1 "|" ;prep for dropdown list
gui,DD:add, dropdownlist,w200 r10 vTable_Nb gSubmit_All, %Table_List%
gui,DD:show
return
Submit_all:
Gui,DD:Submit
Gui,DD:destroy
;***********now extract data*******************
Data:=[]
loop, % Pwb.Document.All.Tags("TABLE")[Table_Nb].Rows.Length-1 {
Row:=Pwb.Document.All.Tags("TABLE")[Table_Nb].Rows[A_Index-1]
rows:="" ;clear out rows
loop, % row.cells.length{
rows.= row.cells[A_Index-1].innerTEXT a_tab
}
if(A_Index=1)
Headers:=RegExReplace(rows,"\t","|")
else
Data.Push(StrSplit(rows," ")) ;add rows to data object
}
Gui,Add,ListView,h900 w1200,%Headers%
for a,b in Data
LV_Add("",b*) ;use variadic function to add columns
Loop,% LV_GetCount("Column")
LV_ModifyCol(A_Index,"AutoHDR") ;adjust column width based on data
gui, show
Table_List:=""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment