FormatCode Code Formatter is based on serveral powerful syntax parser engines
so you can exactly control the appearance of your source code. Here is the code formatting demo of
FormatCode VBScript Code Formatter to prove the ability of code formatting
functions of FormatCode:
strComputer = "."
Set objWMIService = GetObject("winmgmts:{authenticationLevel=pktPrivacy}\\" &_
strComputer & "\root\microsoftiisv2")
Set colItemswb = objWMIService.ExecQuery( "Select * from IIsWebServerSetting" )
Dim WebSiteIds(10)
Dim WebSiteDisplayName(10)
n = 0
For Each objItemwb in colItemswb
WebSiteId = Mid(objItemwb.Name, 7)
WebSiteIds( n ) = WebSiteId
WebSiteDisplayName(n) = objItemwb.ServerComment
n = n + 1
Next
n = n - 1
Set colItems = objWMIService.ExecQuery("Select Name From IIsApplicationPool")
For Each objItem in colItems
Dim AppPool
Dim ln
AppName = objItem.Name
ln=Len(AppName)
AppPool = Mid(AppName , 16 ,ln)
Wscript.Echo ""
Wscript.Echo "+AppPoolId: " & AppPool
For m = 0 to n
WebSiteId = WebSiteIds(m)
objItem.EnumAppsInPool arrApplications
displayWebSite = true
For i = 0 to Ubound(arrApplications)
Dim application
Dim length
Dim arrApp
arrApp = arrApplications(i)
length=Len(arrApp)-5
application = Mid(arrApp , 5 ,length)
nextslashPos = InStr(7, application, "/")
appwebsiteid = Mid(application, 7, nextslashPos - 7 )
matchFound = StrComp( appwebsiteid, WebSiteId )
If matchFound=0 then
if displayWebSite = true Then
Wscript.Echo Space(4) &"+WebSiteID: " & WebSiteId
Wscript.Echo Space(4) & "+WebSite Name: " &_
WebSiteDisplayName(m)
displayWebSite = false
End If
Wscript.Echo Space(8) & "-Application Name: " & application
End if
Next
Next
Wscript.Echo ""
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:{authenticationLevel=pktPrivacy}\\" &_
strComputer & "\root\microsoftiisv2")
Set colItemswb = objWMIService.ExecQuery( "Select * from IIsWebServerSetting" )
Dim WebSiteIds(10)
Dim WebSiteDisplayName(10)
n = 0
For Each objItemwb in colItemswb
WebSiteId = Mid(objItemwb.Name, 7)
WebSiteIds( n ) = WebSiteId
WebSiteDisplayName(n) = objItemwb.ServerComment
n = n + 1
Next
n = n - 1
Set colItems = objWMIService.ExecQuery("Select Name From IIsApplicationPool")
For Each objItem in colItems
Dim AppPool
Dim ln
AppName = objItem.Name
ln=Len(AppName)
AppPool = Mid(AppName , 16 ,ln)
Wscript.Echo ""
Wscript.Echo "+AppPoolId: " & AppPool
For m = 0 to n
WebSiteId = WebSiteIds(m)
objItem.EnumAppsInPool arrApplications
displayWebSite = true
For i = 0 to Ubound(arrApplications)
Dim application
Dim length
Dim arrApp
arrApp = arrApplications(i)
length=Len(arrApp)-5
application = Mid(arrApp , 5 ,length)
nextslashPos = InStr(7, application, "/")
appwebsiteid = Mid(application, 7, nextslashPos - 7 )
matchFound = StrComp( appwebsiteid, WebSiteId )
If matchFound=0 then
if displayWebSite = true Then
Wscript.Echo Space(4) &"+WebSiteID: " & WebSiteId
Wscript.Echo Space(4) & "+WebSite Name: " &_
WebSiteDisplayName(m)
displayWebSite = false
End If
Wscript.Echo Space(8) & "-Application Name: " & application
End if
Next
Next
Wscript.Echo ""
Next
Click here to preview the VBScript Code Formatting Demo 2.
With FormatCode VBScript Code Formatters, you can format and transform any foreign VBScript source code to meet your preferred coding style or any common code convention in several seconds!
|