function test()
{
var string = "a,b,c,d";
var strings_arr = string["split"](",");
for (var i = 0; i < strings_arr["length"]; i++)
{
Log["Message"](strings_arr)
}
}
测试脚本: VBScript
sub test1
dim page
dim w, p
set p = Sys.Process("IEXPLORE")
set w = p.Window("IEFrame", "*")
Set page = w.Page("*").ToURL("file:///C:/temp/test.htm")
page.refresh
Call page.SELECT.TypeSpeed_listTypes.Click("120-APCO")
Call page.SELECT.TypeSpeed_listTypes.Click("130-APCO", skCtrl)
Call page.SELECT.TypeSpeed_listTypes.Click("320-ES", skCtrl)
Call page.SELECT.TypeSpeed_listTypes.Click("3340", skCtrl)
Call page.SELECT.TypeSpeed_listTypes.Click("340/360-ENCL", skCtrl)
Call page.SELECT.TypeSpeed_listTypes.Click("670-VORTEX", skCtrl)
Call page.SELECT.TypeSpeed_listTypes.Click("410-HSC", skCtrl)
Call page.SELECT.TypeSpeed_listTypes.Click("530-ENCLOSED", skCtrl)
Call page.SELECT.TypeSpeed_listTypes.Click("640-SEWAGE", skCtrl)
Call page.SELECT.TypeSpeed_listTypes.Click("110-APCO", skCtrl)
end sub
3.读取文件:
function ReadFile(NameNPath)
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.OpenTextFile(NameNPath,1);
return f.ReadAll();
}
5.获得文件名称
[C#Script]
function fsoTest(){ var fso = Sys.GetOleObject("Scripting.FileSystemObject"); var folder = fso.GetFolder("c:\\"); var folders = new Enumerator(folder.SubFolders); for (; !folders.atEnd(); folders.moveNext()) Log.Message(folders.item());}
6.查找安装进程文件
Public Function GetMSIProcfor i = 1 to 5set msiproc = Sys.WaitProcess("msiexec", 2000, False,i)if msiproc.Exists thenif msiproc.ChildCount > 0 thenset GetMSIProc = msiprocexit functionend ifend ifnextMsgbox "Could not find msiproc with Children terminating"end Function
7.代码例子
Public Function fGetPrivateProfileString(sSection, sKey, sFilePath)
Dim oWSHINI
Dim sDefault
Dim sReturnedString
Dim lSize