怎么自动获得系统对话框上的文字并点击按钮

如何自动获得系统对话框上的文字并点击按钮?
测试代码:

<html>
<head>
<title>网站连接速度测试</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
</head>
<body>
测试网站连接速度:
<script language="javascript">
tim=1
setInterval("tim++",100)
b=1
var autourl=new Array()
autourl[1]="www.baidu.com"
function butt(){
document.write("<form name=autof>")
for(var i=1;i<autourl.length;i++)document.write("<input type=text name=txt"+i+" size=10 value=测试中……> =》<input type=text name=url"+i+" size=40> =》<input type=button value=GO onclick=window.open(this.form.url"+i+".value)><br>")
document.write("<input type=submit value=刷新></form>")
}
butt()
function auto(url){
document.forms[0]["url"+b].value=url
if(tim>200)
{document.forms[0]["txt"+b].value="链接超时"}
else
{document.forms[0]["txt"+b].value="时间"+tim/10+"秒"}
b++
}
function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl[i]+"/"+Math.random()+" width=1 height=1 onerror=auto('http://"+autourl[i]+"')>")}
run()
</script>
</body>
</html>

在本地建一个html文件,代码如上。使用IE内核的浏览器打开时:
怎么自动获得系统对话框上的文字并点击按钮

我想自动查找窗体标题是‘安全警报’的窗体,窗体上包含有‘你确实要让此文件运行活动内容么?’的文本,并点击‘是(Y)’按钮。


------解决思路----------------------
用代码把IE的安全设置调低
------解决思路----------------------
遍历窗口试试
------解决思路----------------------
T:=FindWindowEx(M,0,'Static',nil);后面加一句:
T:=FindWindowEx(M,T,'Static',nil);