IDispatch, Access .Document of Shell.Explorer (ActiveX)
Posted: 30 May 2015, 18:00
I'd like to create a Shell.Explorer ActiveX GUI element, display a website in it and add a javascript to it. This javascript should then tell my AHK script that something happened on certain events.
But I don't understand how the .Document property can be accessed in a useful way. And I also don't know how I can tell the javascript to call a callback function of the AHK script.
This is basically how I'd like it to work:
( Notification.Notification() will actually be called by my website itself. )
I really hope someone can help me out with this.
But I don't understand how the .Document property can be accessed in a useful way. And I also don't know how I can tell the javascript to call a callback function of the AHK script.
This is basically how I'd like it to work:
Code: Select all
Gui, 1: Add, ActiveX, x0 y0 w800 h500 vWB -HScroll, Shell.Explorer
Gui, Show, w800 h500, test
scriptToInject =
(
function Notification() {
this.Notification = function(title, options) {
WB_NotificationCallback(title,options);
}
}
Notification.Notification("Test notification.")
)
WB.silent := True
WB.Navigate("example.com")
While (WB.busy or WB.readystate != 4)
Sleep 100
WB.Navigate("javascript:" scriptToInject)
WB_NotificationCallback(text) {
TrayTip, New Notification, % text
}
GuiClose() {
ExitApp
}
I really hope someone can help me out with this.