This is basically what I'm doing atm:
Code: Select all
window.call___back := Func("msg")
window.addEventListener("mousemove",window.call___back)
msg(e:="") {
TrayTip, Mouse position on page, % "x: " e.pageX "`ny: " e.pageY
}
Any idea how I could get the missing event info?
(I'm not interested getting the info in JavaScript btw. It has to be the AHK function.)
Here is the whole script so far:
(Open an IE window, navigate to a website, make sure the window is active, press F3 and move the mouse over the page.)
Code: Select all
#Persistent
active:={ie:IeGet()}
ActiveIeMonitorWithParam := Func("ActiveIeMonitor").Bind(active)
SetTimer, % ActiveIeMonitorWithParam, 100
width := 400
height := 200
Gui, +AlwaysOnTop +hwndHWND
Gui, Add, Edit, vGUI_InfoBox w%width% h%height%
Gui, Show, % "x" A_ScreenWidth-width-30 " y" 5, Bruttos iWB2 Learner
WinSet, Transparent, 200, ahk_id %HWND%
Return
F3::
IE := active.ie
If !ComObjType(IE,"IID")
Return
doc := IE.document
document := doc.documentElement
window := ComObj(9,ComObjQuery(IE,"{332C4427-26CB-11D0-B483-00C04FD90119}","{332C4427-26CB-11D0-B483-00C04FD90119}"),1)
info := "Title: " doc.title "`n"
info .= "Url: " IE.locationUrl "`n"
;window.eval("alert('injected javascript!');")
;window.eval("window.addEventListener('click',call___back);")
window.call___back := Func("msg")
window.addEventListener("mousemove",window.call___back)
GuiControl,, GUI_InfoBox, % info
Return
msg(e:="") {
Global document
traytip, Mouse position on page, % "x: " e.pageX "`ny: " e.pageY
;MsgBox % document.elementFromPoint(e.pageX, e.pageY).innerHTML
}
IeGet(hWnd:=0) {
WinGetTitle, title, % (hWnd ? "ahk_id " hWnd : "A")
For window in ComObjCreate("Shell.Application").windows
If (InStr(window.fullName, "iexplore.exe") && window.document.title . " - Internet Explorer" = title)
Return window
Return {}
}
ActiveIeMonitor(ByRef active) { ;we're using active.ie because it doesn't appear to be possible to pass a COM object directly using .Bind and SetTimer...
active.ie := IeGet()
}
GuiClose() {
ExitApp
}