Mixing JScript and VBScript --> <job id="SORT-VBScriptWithJScript"> <script language="JScript"> function SortVBArray(arrVBArray) {return arrVBArray.toArray().sort();} </script> <script language="VBScript"> ' <![CDATA[ '** Fastest sort: call the Jscript sort from VBScript myData = "a,b,c,1,2,3,X,Y,Z,p,d,q" wscript.echo "Original List of values: " & vbTab & myData starttime = timer() sortedArray = SortVBArray(split(myData,",")) endtime=timer() jscriptTime = round(endtime-starttime,2) wscript.echo "JScript sorted in " & jscriptTime & " seconds: " & vbTab & sortedArray ' ]]> </script> </job> The output looks like this, sorted by ASCII code sequence: Original List of values: a,b,c,1,2,3,X,Y,Z,p,d,q JScript sorted in 0 seconds: 1,2,3,X,Y,Z,a,b,c,d,p,q Exposing constants Another very useful feature of a WSF is that the XML wrapper can be bound to an object reference or control so you can use that object's constants instead of having to declare them. In regular VBScript and JScript files, you would be forced to declare a constant's value (outside those that are internal to the Windows Script Host) in order to use the constant. An example of this is shown below: const adLockBatchOptimistic = 4 MsgBox "The value of ""adLockBatchOptimistic"" is " & _ adLockBatchOptimistic & ".", vbInformation,"adLockBatchOptimistic" If your object documentation only refers to the constant's name and not the constant's value, you would have no way of knowing the value without the help of an Integrated development environment to tell you what they equate to. By using the WSF reference declaration, you can use the constants without declaring their values. The example below enumerates the values of several common constants in the ADO (ActiveX Data Objects) Recordset. <?xml version="1.0" ?> <!-- WSF Example with Object Reference Notes for this very formal example: CDATA is used to help the XML parser ignore special characters in the content of the script. The CDATA open and close must be masked from VBScript by making them comments. --> <package> <job id="EnumerateConstantsADO"> <reference object="ADODB.Recordset" /> <script language="VBScript"> ' <![CDATA[ dim title, str, i ctecArray = Array("adOpenUnspecified","adOpenForwardOnly", _ "adOpenKeyset","adOpenDynamic","adOpenStatic") title = "ADO Recordset Values for Constants" str = title & vbNewLine & vbNewLine str = str & "*CursorTypeEnum Constants*" & vbNewLine For i = 0 to ubound(ctecArray) str = str & Eval(ctecArray(i)) & vbTab & ctecArray(i) & vbNewLine Next str = str & vbNewLine str = str & "*LockTypeEnum Constants*" & vbNewLine ltecArray = Array("adLockUnspecified","adLockReadOnly", _ "adLockPessimistic","adLockOptimistic", _ "adLockBatchOptimistic") For i = 0 to ubound(ltecArray) str = str & Eval(ltecArray(i)) & vbTab & ltecArray(i) & vbNewLine Next MsgBox str, vbInformation, Title