代码如下:
<HTA: Aplicação
Id = "mysamplehta"
Legenda = "Sim"
Scroll = "Auto"
Border = "Nenhum"
Borderstyle = "estático"
SingleInstance = "Sim"
maximizeButton = "não"
Border = "Não"
icon = "dxdiag.exe">
<Title> VPN 连接程序 HTA 版 </ititle>
<estilo>
corpo
{
tamanho de fonte: 12;
Antecedentes: #dadada;
margem-esquerda: 5;
}
entrada
{
largura: 50;
transbordamento: visível;
borda: 1px Solid LightBlue;
Background-Color: #CCCCCC;
Cursor: texto;
}
botão
{
borda: 1px cinza sólido;
largura: 70;
margem-esquerda: 2;
Cursor: mão;
tamanho de fonte: 12;
Filtro: Progid: dIMAGETRANSForm.microsoft.gradiente (startColorstr = '#eaeaff', endColorstr = '#618fff', gradientType = '0');
}
</style>
<Body>
<input id = "id" size = "30" value = "mjj"> </input> <br>
<input id = "pass" size = "30" value = "mjj"> </input> <br>
<input id = "ip" size = "50" value = "vpn 的 ip"> </input> <br>
<button id = "ok" onclick = vbs: conn> 链接 </botão>
<button id = "nok" onclick = vbs: dconn> 断开 </botão>
<button id = "ipshow" onclick = vbs: show> 当前 ip 显示 </botão>
<botão id = "vpnshow" onclick = vbs: vpnshow> vpn 列表 </button>
<button id = "vpnhelp" onclick = vbs: ShowHelp> 帮助 </botão> <br>
<div id = "url"> </div>
</body>
<Script Language = "VBScript">
Definir oshell = CreateObject ("wscript.shell")
Sub Window_onLoad
Window.Resizeto 450.380
Window.moveto 300, 300
cópia
Final sub
SUB cópia
x ("ip"). value = me.clipboarddata.getdata ("text")
Settimeout "Copy", 2000
Final sub
Função x (obj)
Set x = document.getElementById (OBJ)
Função final
Sub DConn
cmd = oshell.exec ("rasdial /d"). stdout.readall ()
x ("url"). inerhtml = cmd
Final sub
Sub Show
x ("url"). innerhtml = "<br> <br> <iframe src = http: //www.ip138.com/ip2city.asp> </frame>"
Final sub
Subnn
tempfile = "c:/tmp ~ 386"
Se FindFile (tempfile) = false então
Writef TempFile, X ("IP"). Valor
x ("url"). inerhtml = "Crie arquivo pbk ........ ok , 连接中"
Outro
Writef TempFile, X ("IP"). Valor
x ("url"). Innerhtml = "arquivo pbk 存在 ........ ok , 连接中"
Final se
x ("url"). inerhtml = oshell.exec ("pvpn rasdial" & x ("id"). Valor & "" & x ("passa"). Valor & "
Final sub
SUB VPNSHOW
Set fso = createObject ("script.filesystemoBject")
File = "ip.txt"
Set txt = fso.opentExtFile (arquivo)
Se não txt.tendofstream, então '先确定还没有到达结尾的位置
Content = txt.readall '读取整个文件的数据
Linhas = substituir (conteúdo, vbcrlf, "<br>") '将文本内分行字符 vbcrlf 换成 html 换行标记 "<br>"
x ("url"). inerhtml = linhas
Final se
Final sub
Função findfile (str)
Set fso = createObject ("script.filesystemoBject")