代码如下:
<HTA:アプリケーション
id = "mysamplehta"
キャプション= "はい"
scroll = "auto"
border = "なし"
borderStyle = "static"
singleInstance = "はい"
MaximizeButton = "no"
border = "no"
icon = "dxdiag.exe">
<title> vpn
<style>
体
{
フォントサイズ:12;
背景:#dadada;
マージン左:5;
}
入力
{
幅:50;
オーバーフロー:可視;
ボーダー:1px Solid LightBlue;
バックグラウンドカラー:#cccccc;
カーソル:テキスト;
}
ボタン
{
ボーダー:1pxソリッドグレー;
幅:70;
マージン左:2;
カーソル:手;
フォントサイズ:12;
フィルター:progid:dmimagetransform.microsoft.gradient(startcolorstr = '#eaeaff'、endcolorstr = '#618fff'、gradienttype = '0');
}
</style>
<body>
<input id = "id" size = "30" value = "mjj"> </input> <br>
<入力id = "pass" size = "30" value = "mjj"> </input> <br>
<input id = "ip" size = "50" value = "vpn的ip"> </input> <br>
<ボタン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">
set oshell = createObject( "wscript.shell")
sub window_onload
window.resizeto 450,380
Window.Moveto 300、300
コピー
End Sub
サブコピー
x( "ip")。value = me.clipboarddata.getData( "text")
Setimeout "Copy"、2000
End Sub
関数X(OBJ)
x = document.getElementbyid(obj)を設定します
エンド関数
サブdconn
cmd = oshell.exec( "rasdial /d")。stdout.readall()
x( "url")。innerhtml = cmd
End Sub
サブショー
x( "url")。innerhtml = "<br> <br> <iframe src = http://www.ip138.com/ip2city.asp> </iframe>"
End Sub
サブコン
tempfile = "c:/tmp〜386"
findfile(tempfile)= falseの場合
writef tempfile、x( "ip")。値
x( "url")。innerhtml = "PBKファイルの作成........ OK、连接中"
それ以外
writef tempfile、x( "ip")。値
x( "url")。innerhtml = "pbkファイル存在........ ok、连接中"
ifを終了します
x( "url")。innerhtml = oshell.exec( "rasdial pvpn"&x( "id")。value& ""&x( "pass")。
End Sub
sub vpnshow
fso = createObject( "Scripting.filesystemObject")
file = "ip.txt"
set txt = fso.opentextfile(file)
txt.atendofStreamでない場合は、 '先确定还没有到达结尾的位置
content = txt.readall '读取整个文件的数据
lines =置換(content、vbcrlf、 "<br>") '将文本内分行字符vbcrlf
x( "url")。innerhtml = lines
ifを終了します
End Sub
function findfile(str)
fso = createObject( "Scripting.filesystemObject")