Script Control component Win7 X64 platform running problems and examples, win7x64
Key points of this article:
It is estimated that the discount theft is very serious. As soon as this article is published, it is doomed to be copied, marking it: By @ Jimbowhy @ Source Address:
Http://blog.csdn.net/winsenjiansbomber/article/details/41376999
At the same time, I absolutely have a reason to believe that adding words like mywife. cc in the article will greatly increase the page views of this article! Haha :) It is also a popular promotion of script applications!
/* MSSCRIPT.OCX Microsoft Script Control 1.0 is ready for x86 system * it may site in c:\Windows\SysWOW64\msscript.ocx * and must run x86 version WScript.exe to execute this script *///var sc = new ActiveXObject("MSScriptControl.ScriptControl");var sc = WScript.CreateObject("MSScriptControl.ScriptControl","ScriptControl_");sc.Language = "VBScript";sc.AllowUI = true;sc.Timeout = 3000;/* This may occurs 80004005 before Language setted: * The operation could not be completed * because the script engine has not been initialized to a valid language. */sc.AddObject("WScript", WScript);//sc.addCode('On Error Resume Next'); // add code to Global Module!//sc.AddCode('x=1/0'); // Execute right now and causes Error event// Delay sub about 5s in my 1.6Ghz 4 Cores CPU, so it will cause 3s Timeout event!var vbs = 'Sub Main(msg) : For i = 1 to 5000000 Step 1 : x=x+i : Next : MsgBox msg&vbCrLf&"Delay Done:"&i : End Sub';//sc.Eval(vbs); // Error, just expression to Evalsc.AddCode(vbs);sc.Run("Main","Hi, Main");//var vbs = 'Function Main(msg) : MsgBox(msg) : End Function'; // Why not ByVal msg As String?var vbs = 'Sub Main(msg) : MsgBox("Modules:"+msg) : End Sub'; // just Public not Private membervar m = sc.Modules.Add("Module1");m.AddCode(vbs);m.Run("Main","Hi, Main");sc.Language = "JScript";sc.AddObject("WScript", WScript); // reset when Language changedsc.AddCode('WScript.Echo("Hi,JS");');/* Events for Script Control * Timeout: Occurs when the time specified in the Timeout property has elapsed, * and a user has selected End from the resulting dialog box. */function ScriptControl_Timeout(){ WScript.Echo("Event: ScriptControl Timeout "+sc.Timeout);}/* Error: An Error event can occur during event sinking or during a direct call * to the scripting engine when calling into an object returned by the CodeObject * property. The error argument is the number of the run-time error that occurred. */function ScriptControl_Error(){ var msg = "Event: ScriptControl Error " + "\nLine:" + sc.Error.Line + "\nColumn:" + sc.Error.Column + "\nNumber:" + sc.Error.Number + "\nDescription:" + sc.Error.Description; sc.Error.Clear(); WScript.Echo(msg);}
Jimbowhy has collected a large amount of collected information about Windows Scripting Host, which is a very practical antique programming technology. Please download it from Yunxiao for free:
Http://pan.baidu.com/s/1i3Br5OD
Including:
Advanced VBSript for Microsoft Windows Administrators.pdf
Advanced Windows Script Host Developers Guide (2003). pdf
IVIEWERS. DLL
Microsoft VBScript Step by stepstep
Microsoft Windows Script technology. CHM
OLEVIEW. EXE
Source code 5.6
Script56.chm JScript & VBScript official reference manual 5.6 e version
Scripten.5.7.0.16535.win2k.exe JScript & VBScript Installer
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_common script. docx
Sct10en.exe Microsoft Script Control 1.0
MSSCRIPT. chm Microsoft Script Control 1.0 English manual CHM format
MSSCRIPT-CHS.chm Microsoft Script Control 1.0 Chinese manual CHM format