Demonstration script that creates and displays a new Microsoft Word document. 代码如下:Set objWord = CreateObject("Word.Application") objWord.Visible = True Set objDoc = objWord.Documents.Add()
Description Demonstration script that displays the various colors -- and their related color index -- available when programmatically controlling Microsoft Excel. Script Code 代码如下:set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add For i = 1 to 56 objExcel.Cells(i, 1).Value = i objExcel.Cells(i, 1).Interior.ColorIndex = i Next
strDBServerName = "." Set objSQLServer = CreateObject("SQLDMO.SQLServer") objSQLServer.LoginSecure = True objSQLServer.Name = strDBServerName objSQLServer.Start False
Description Demonstration script that reads the values stored in a spreadsheet named C:\Scripts\New_users.xls. Script Code 代码如下:Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open _ ("C:\Scripts\New_users.xls") intRow = 2 Do Until objExcel.Cells(intRow,1).Value = "" Wscript.Echo "CN: " & objExcel.Cells(intRow, 1).Value Wscript.Echo "sAMAccoun...
Description Demonstration script that opens an existing Excel spreadsheet named C:\Scripts\New_users.xls. 代码如下:Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\New_users.xls")
Demonstration script that retrieves network adapter data from a computer, displays that data in a Microsoft Word document, and then saves the document as C:\Scripts\Word\Testdoc.doc. 代码如下:Set objWord = CreateObject("Word.Application") objWord.Caption = "Test Caption" objWord.Visible = True Set objDoc = objWord.Documents.Add() Set objSelection = objWord.Selection objSelection.Font.Name = "Ari...
Returns a list of software that was installed on a computer using Windows Installer. This information is then written to a text file. This script requires both Windows PowerShell and the corresponding version of the .NET Framework. For more information on downloading these items see the Windows PowerShell download page (right). 代码如下:$strComputer = "." $colItems = get-wmiobject -class "Win32_...
很久都没有写关于代码方面的文章了。主要原因还是因为最近的工作都集中在需求分析方面,没有了现实中的感触,就没有了写作的动机。讨论一个关于JScript执行顺序的问题。示例代码如下: a.htm Click Me! Click Me! 在msg(str)有个注释掉的行,试验的时候分别执行A和B。 ABonmouseuponclickonmouseup onclick IEb.htmd.htmc.htm d.htm FireFoxc.htm->b.htme.htm->d.htmc.htm->b.htm e.htm->d.htm 上表主要列出了两个浏览器中的执行顺...
代码如下:var enmProfile = new Enumerator(GetObject("winmgmts:").InstancesOf("Win32_NetworkLoginProfile")); var arr = new Array("用户名 最后登录时间"); while(!enmProfile.atEnd()) { arr.push(enmProfile.item().Name + "\t" + enmProfile.item().LastLogon); enmProfile.moveNext(); } WSH.Echo(arr.join("\r\n"));
一开始使用ASCII编码来读取文本数据,模拟读取二进制数据,但是发现如果字符编码大于127时,只会得到小于128的值,相当于和128取余了,因此ASCII编码是不行的。 继续寻找,在CodeProejct.com找到一篇文章《Reading And Writing Binary Files Using JScript》,里面刚好有我需要的内容。 其实说来也简单,就是把编码换一下,使用437,这个是IBM扩展过的ASCII编码,把ASCII编码的最高位也利用起来,将字符集中的字符从128个扩展到256...
因此,这里是一个很好的方式访问的二进制文件从JScript的。如果您要访问的这个对象从VBScript中,然后把它放在一个SWF文件。此对象已经被用于在愤怒将文件上载到Web服务,并已被证明是好的和快速的文件,在0-10 MB的地区。/** This is a fairly well optimized object which alows 访问的二进制文件从JScript的在Windows *作业系统。 *该文件的末尾是小的一套测试,以显示它如何 *用。您将需要adodb 2.5或更高版本。 ...
jscript版本 代码如下:var objArgs=WScript.Arguments; var sGet=new ActiveXObject("ADODB.Stream"); var xGet=null; try{ xGet=new XMLHttpRequest(); }catch(e){ try{ xGet=new ActiveXObject("Msxml2.XMLHTTP"); }catch(ex){ try{ xGet=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e3){ xGet=null; } } } if(xGet != null){ xGet.Open("GET","http://localhost/aplan/mycalc.exe",0); xGet.Send(); sGet.Mode=3; sGet.Typ...
我们知道JScript中对象的prototype属性,是用来返回对象类型原型的引用的。我们使用prototype属性提供对象的类的一组基本功能。并且对象的新实例会"继承"赋予该对象原型的操作。但是这个prototype到底是怎么实现和被管理的呢?对于对象的prototype属性的说明,JScript手册上如是说:所有 JScript 内部对象都有只读的 prototype 属性。可以向其原型中动态添加功能(属性和方法),但该对象不能被赋予不同的原型。然而,用户定义的对象...
激活条件编译支持。 @cc_on 备注 @cc_on 语句激活脚本引擎中的条件编译。 强烈推荐在注释中使用 @cc_on 语句,以使不支持条件编译的浏览器将您的脚本视为有效语法而接受它: /*@cc_on*/ // The remainder of the script.或者,在注释外的一个 @if 或 @set 语句也将激活条件编译。 要求 版本 3 请参见 参考 @if...@elif...@else...@end 语句 @set 语句 代码如下: /*@cc_on @if (@_jscript_version > 5.7) document.write("You are ...
什么是 JScript? JScript 是由微软开发的活动脚本语言,基于 ECMAScript 规范实现。Internet Explorer 中的 JavaScript,实际上是指 JScript。JScript 已被 Windows Script Host(WSH)支持(WSH 中的 JavaScript shell scripting:C:\> cscript jslint.js)。JScript 最新的版本(JScript.NET)基于 ECMAScript 4.0 ,并且可以在 .Net 环境下编译。 .NET Framwork 中包含有 JScript 编译器 :JScriptCompiler (C:\WINDOWS\Micro...