代码如下:
<hta:应用程序
id =“ mySampleHta”
字幕=“是”
滚动=“自动”
边界=“无”
borderstyle =“静态”
singleSinstance =“是”
最大化布顿=“否”
边界=“否”
图标=“ dxdiag.exe”>
<title> VPN连接程序hta版</title>
<样式>
身体
{
字体大小:12;
背景:#Dadada;
左键:5;
}
输入
{
宽度:50;
溢出:可见;
边界:1PX固体灯光;
背景色:#cccccc;
光标:文字;
}
按钮
{
边界:1px固体灰色;
宽度:70;
左键:2;
光标:手;
字体大小:12;
过滤器:progid:dximagetransform.microsoft.gradient(startColorStr ='#eaeaff',endColorstr ='#618fff',gradientType ='0');
}
</style>
<身体>
<输入id =“ id” size =“ 30” value =“ mjj”> </input> <br>
<输入id =“ Pass” size =“ 30” value =“ mjj”> </input> <br>
<输入id =“ ip” size =“ 50” value =“ VPN的ip”> </input> <br>
<button ID =“ ok” onclick = vbs:conn>链接</button>
<button ID =“ nok” onclick = vbs:dconn>断开</button>
<button ID =“ ipshow” onclick = vbs:show>当前ip </button>
<button ID =“ vpnshow” onclick = vbs:vpnshow> vpn列表</button>
<button ID =“ vpnhelp” onclick = vbs:showhelp>帮助</button> <br>
<div ID =“ url”> </div>
</body>
<脚本语言=“ vbscript”>
设置oshell = createObject(“ wscript.shell”)
sub Window_onload
Window.Resizeto 450,380
Window.Moveto 300,300
复制
结束子
子副本
x(“ ip”)。值= me.clipboarddata.getdata(“ text”)
Settimeout“复制”,2000年
结束子
功能x(obj)
设置x = document.getElementById(obj)
结束功能
sub dconn
cmd = oshell.exec(“ rasdial /d”)。stdout.readall()
x(“ url”)。innerhtml = cmd
结束子
子显示
x(“ url”)。innerhtml =“ <br> <br> <iframe src = http://www.ip138.com/ip2city.asp> </iframe>”
结束子
子连接
tempfile =“ c:/tmp〜386”
如果findfile(tempfile)= false,则
writef tempfile,x(“ ip”)。值
x(“ url”)。innerhtml =“创建pbk文件........好,连接中”
别的
writef tempfile,x(“ ip”)。值
x(“ url”)。innerhtml =“ pbk file存在..........好,连接中”
如果结束
x(“ url”)。innerhtml = oshell.exec(“ rasdial pvpn”&x(“ id”)。value&x&x(“ pass”)。value&“ value&” /phonebook:“&tempfile).stdout.readall()
结束子
sub vpnshow
set fso = createObject(“ scripting.filesystemobject”)
file =“ ip.txt”
设置txt = fso.opentextfile(文件)
如果不是txt.atendofstream,则'先确定还没有到达结尾的位置
content = txt.readall'读取整个文件的数据
lines =替换(content,vbcrlf,“ <br>”)'将文本内分行字符vbcrlf换成html换行标记“ <br>”
x(“ url”)。innerhtml =线
如果结束
结束子
功能Findfile(str)
set fso = createObject(“ scripting.filesystemobject”)