24-9 使用 wsInetTools.dll

ڭ̤]iHgѦUؤӥ[j WSH \CҦpAڭ̥iHU wsInetTools.dllAoO@Өϥ C++ }oADnUCT\G wsInetTools TAiUCoG
http://www.winscripter.com/Downloads/default.aspx
ѥHWAANiHU zip ɮס]Υ .../wsh/download/wsInetTools03B.zipoݳƥ^AѶ}HANiHݨ wsInetTools.ll άdҤλCAiU᪺ index.htmG

Example]../download/wsInetTools03B/index.html^G

nϥΦ󤧫eANntΤAiHBJG

  1. N wsInetTools.dll c:\windows\system32\ UC
  2. Iu}l/vAMJuregsvr32 wsInetTools.dllvAUuTwvANFnʧ@C
WzBJANiH}lϥ wsInetTools.dllCHUϥδXӽdҨӻ󪺥\CAUCoӽdҬOiH HTML G

lɡ]wsInetTools/getWebPage01.js^G]ǦϰUYi^
// ϥ wsInetTools.dll  HTML ɮסC
web  = new ActiveXObject("wsInetTools.HTTP");	// o COM 
url = "http://www.cs.nthu.edu.tw";		// U
contents = web.GetWebPage(url);			// }lU
WScript.Echo("Uu"+url+"v\IɮפepUG");
WScript.Echo(contents);				// ܺe

YnGiɮסAҦp@ Midi 榡ɮסAiUCdҡG

lɡ]wsInetTools/getBinary01.js^G]ǦϰUYi^
//  binary ɮסAҦp MIDI  MP3 ɮ׵C
web = new ActiveXObject( "wsInetTools.HTTP" );		// o COM 
// wqݤΥɮ
remoteFile = "http://neural.cs.nthu.edu.tw/jang/books/JavaScript/example/music/tomorrow.mid";	// ɮ
localFile  = "tomorrow.mid";				// ɮ
web.GetBinary(remoteFile, localFile);			// }lU
WScript.Echo("Uu"+remoteFile+"v\I");
WScript.Echo("sɮסGu"+localFile+"vI");

YnHolAiUCdҡG

lɡ]wsInetTools/sendMail01.js^G]ǦϰUYi^
// ϥ wsInetTools.dll HeqllC
mail = new ActiveXObject("wsInetTools.SMTP");	// o COM  
mail.MailServer = "wayne.cs.nthu.edu.tw";	// ]wlA
// ]wlUةʽ       
from    = "jang@wayne.cs.nthu.edu.tw";		// oHH
to      = "jang@cs.nthu.edu.tw";		// HH
subject = "Testing wsInetTools";		// DD
body    = "This is just a test message.\r\n Please ignore it.\r\n\r\nRoger Jang";	//     
mail.SendMail(from, to, subject, body);		// }lHol
WScript.Echo("Hel󦨥\I");

QΦAڭ̤]iHb ASP {X̭HelC


JScript {]pPΡGΩ WSH