VBA的inputBox函數的JScript類比,inputboxjscript
本文要點:
估計這文章一發表就註定被轉抄的命運了,標記一下源地址:http://blog.csdn.net/winsenjiansbomber/article/details/41338243
/* Tips: an alert emulator for Wscript host */function alert(msg){ WScript.Echo(msg+"");}// Binding event handler prefix: ONIE_var IE = WScript.CreateObject("InternetExplorer.Application","ONIE_");IE.left=50;IE.top = 100;IE.height = 200;IE.width = 350;IE.menubar = false;IE.toolbar = false;IE.statusbar = false;IE.resizable = false;IE.navigate("c:\\temp\\readme.html");IE.visible = true;while(!IE.Document.Script.GetValue){ // break when page load and run WScript.Sleep( 300 );}alert("Please click OK");//alert(IE.Document.Script);//alert(IE.Document.body);//alert(IE.Document.Script.GetValue);alert("GetValue()="+IE.Document.Script.GetValue());WScript.DisconnectObject( IE );IE.Quit()alert("Disconnected");function ONIE_WindowStateChanged(state){ alert("Event: Window State Changed to "+state);}// Raised from loading a document in Internet Explorerfunction ONIE_DownloadBegin(){ alert("Event: Download begins");}/* Raised from quitting Internet Explorer, but we're * disconnecting from the object before calling * the Quit method to terminate Internet Explorer, so * the dialog box isn't shown. */function ONIE_OnQuit(){ alert("Event: Quit Internet Explorer");}
readme.html:
<!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title> Test </title> </head> <body> <label>請輸入:<input id="box" style="width:120px;" /></label> <script type="text/javascript"> function GetValue(){ return document.getElementById("box").value; } </script> </body></html>
關於Windows Scripting Host這個很實用的古董編程技術,Jimbowhy 收集了大量收藏級的資料,請到雲盤免費下載:
http://pan.baidu.com/s/1i3Br5OD
包括:
Advanced VBSript for Microsoft Windows Administrators.pdf
Advanced Windows Script Host Developers Guide (2003) .pdf
IVIEWERS.DLL
Microsoft VBScript Step by Step.pdf
Microsoft Windows指令碼技術.CHM
OLEVIEW.EXE
scd56chs.exe JScript & VBScript 官方參考手冊 5.6中文版
script56.chm JScript & VBScript 官方參考手冊 5.6 e文版
scripten.5.7.0.16535.win2k.exe JScript & VBScript 安裝程式
scripten.5.7.0.16535.win2k3 .exe
scripthost20dev.chm Microsoft Windows Script Host 2.0 Developer’s Guide / Günter Born.<
script_repository10.chm System Administration Scripting Guide Script RepositoryVersion 1.0, May 2002
VBScript Programmer's Reference, 3rd Edition.pdf
VBScript程式員參考手冊.pdf
VBS_常用指令碼.docx
sct10en.exe Microsoft Script Control 1.0
MSSCRIPT-CHS.chm Microsoft Script Control 1.0 英文手冊的CHM格式
MSSCRIPT-CHS.chm Microsoft Script Control 1.0 中文手冊的CHM格式
InternetExplorer對象參考:http://msdn.microsoft.com/en-us/library/aa752084