thanks joedf!
Anyway i found a workaround today and really excited of the results. Now html gui can see IE10 css3, such as transition, view svg picture and border-radius.. call javascript, using javascript "window.location()" and "<a href" link to call autohotkey commands. Although it's not as easy as using .getElementById(), using .BeforeNavigate2 event does the trick. But how much i wish to use the "natural" way .getElementById()
anyway, here's the ahk script for those who want to see what i mean
Code: Select all
coordmode, mouse, screen
mousegetpos theX, theY
Gui destroy ; destroy previously opened gui, prevent duplicate
Gui add, activeX, w100 h90 vTest, shell.explorer
test.silent := true
test.navigate("D:\htmgui.html")
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
CustomColor = 555555
Gui, Color, %CustomColor%
WinSet, TransColor, %CustomColor% 255
while test.readyState != 4 or test.busy
sleep 100
;test := test.document.getElementById("div1") ; this method will fail... WHY WHY!
ComObjConnect(test, "test_")
Gui, Show, x%theX% y%theY%, htmgui_tester
test_BeforeNavigate2(test, theUrl) {
; beforeNavigate2 will use 1st parameter "test" Object and 2nd parameter "url" for processing.
; check http://msdn.microsoft.com/en-us/library/aa752085 for more events and parameters they support.
test.Stop() ; prevent navigating and do something else below this script:
if (InStr(theUrl,"myapp://")==1) {
; ensures BeforeNavigate2 event received theUrl that contain "myapp://"
; either fired by href from "a" link tag or window.location("") from javascript will produce BeforeNavigate2 event
stuff := SubStr(theUrl,Strlen("myapp://")) ;get stuff after "myapp://"
if InStr(stuff,"msgbox/cool"){
MsgBox ,,,Five!! 1,0.1
MsgBox ,,,Five!! 2,0.2
MsgBox ,,,Five!! 3,0.3
MsgBox ,,,Five!! 4,0.4
MsgBox ,,,Five!! 5,0.5
}else if InStr(stuff,"msgbox/woah")
soundbeep
else if InStr(stuff,"msgbox/js"){
SoundPlay, %A_WinDir%\Media\tada.wav
sleep 3000
}
}
Gui destroy
SetTitleMatchMode RegEx
WinActivate, i).*autohotkey.ahk.*
}
return
htmgui.html file (put this html file in the correct directory where test.navigate("D:\htmgui.html") refers)
note: <meta http-equiv="X-UA-Compatible" content="IE=10"> is important to make latest css styles work.
Code: Select all
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
a{
position:relative;
height:25px;
display:block;
overflow:hidden;
border-radius:5px;
background-color: #FC6;
background-image:url(borderadius.svg);
background-position:0px 0px;
background-size:100% 100%;
background-repeat:no-repeat;
margin-bottom:3px;
text-align:center;
text-decoration:none;
line-height:25px;
font-size:15px;
font-weight:500;
font-family:sylfaen, Geneva, sans-serif;
color:#060;
cursor:pointer;
}
</style>
<meta http-equiv="X-UA-Compatible" content="IE=10">
<title>Html Gui</title>
</head>
<body style="margin:0px; padding:0px; overflow:hidden; background-color:#555555;"><!-- EEAA99 -->
<div id="div1" style="position: relative; height:25px; display: block; text-align:center; line-height:25px; margin-bottom:3px; background-color:#09F; border: 1px solid black; border-radius:5px; overflow:hidden; cursor:not-allowed;" onClick="joy();window.location('myapp://msgbox/js');">
Javascript..?!
</div>
<a id="a1" href="myapp://msgbox/cool">Gime 5!</a>
<a id="a2" href="myapp://msgbox/woah">Say Beep!</a>
<div id="div2" style="position: absolute; top:0px; left:0px; width:100%; height:100%; display:inline-block; text-align:center; font-family:tahoma; font-size: 15px; color: white; border:1px solid green; box-sizing:border-box; border-radius:10px; background-color:black; opacity:0; visibility:hidden;">
Javascript is safe and sound!
</div>
</body>
<script>
function joy(){
document.getElementById("div2").style.visibility = "visible";
document.getElementById("div2").style.transition = "opacity 1s ease";
document.getElementById("div2").style.opacity = 1;
}
</script>
</html>
credit goes to joedf, ahk script was partially taken from his/her 1st post in this topic. Now html gui wildest dreams can come true
. Still hoping .getElementById() will work some day.. instead of using URL method with BeforeNavigate2 event (perhaps it works but i've not seen enough ahk scripts? or shell.explorer require update? because .getElementById() only available for use up to IE7)
Button's border (using svg image to test browser support)