VbsEdit, the award-winning VBScript editor that dramatically reduces the time you spend writing .VBS scripts

Sample scripts


Scripting Techniques
   Displaying Output
       Sort WMI Data with Bubble Sort , WMI

' Sort WMI Data with Bubble Sort



Dim arrNames()
intSize = 0
strComputer = "."
strClass = "Win32_Process" 'Can use Win32_Service or Win32_Directory
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from " & strClass)

For Each objItem in colItems
  ReDim Preserve arrNames(intSize)
  arrNames(intSize) = objItem.Name
  intSize = intSize + 1
Next

For i = (UBound(arrNames) - 1to 0 Step -1
  For j = 0 to i
    If UCase(arrNames(j)) >UCase(arrNames(j + 1)) Then
      strHolder = arrNames(j + 1)
      arrNames(j + 1) = arrNames(j)
      arrNames(j) = strHolder
    End If
  Next
Next 

For Each strName in arrNames
  Wscript.Echo strName
Next



VbsEdit includes all these samples!




Download Now!

Version 5.4.1 - This package includes VbsEdit 32-bit, VbsEdit 64-bit, HtaEdit 32-bit and HtaEdit 64-bit.
The evaluation version never expires.



Home

Copyright (C) 2001-2012 Adersoft