VBScript Code Formatting Demo


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:

   '--- Before Code Formatting ---

   ON ERROR RESUME NEXT:Set fso = CreateObject("Scripting.FileSystemObject"):X=0:T=true
   WhiLe TInput=Inputbox("Filename Lowercase Batch Convertor"&vbcrlf&vbcrlf& _
   "Please input the destination folder name. e.g. C:\Web"&vbcrlf&vbcrlf& _
   "Note: Do NOT add '\' in the end of folder name!","FLowercase Convertor","C:\")
   iF Input="" then:Msgbox"Folder name is empty!",48,"Error!":T=true:else T=false
   end If:wend
   Msgbox"All files names of "&Input&" will be converted to lowercase now",64,"Note"
   fold(Input):Msgbox"Done! Total "&X&" file(s) were converted to lowercase.",64,"Done"
   sub fold(Path):SET f=fso.GetFolder(Path):Set rf = fso.GetFolder(Path).files
   Set fc = f.SubFolders
   foR EACh fff in rf:lcf1=LCase(fso.GetAbsolutePathName(fff))
   fso.MoveFile fff, lcf1:X=X + 1:next:for EacH f1 in fc:fold(f1)
   Set file=fso.GetFolder(f1).files:fOR EACh ff iN file
   lcf=LCase(fso.GetAbsolutePathName(ff))
   fso.MoveFile ff,lcf:NEXT:NEXT:END sub


   '--- After Code Formatting ---

   On Error Resume Next
   Set fso = CreateObject("Scripting.FileSystemObject")
   X = 0
   T = True

   While T
       Input = InputBox("Filename Lowercase Batch Convertor" & vbCrLf & vbCrLf & _
       "Please input the destination folder name. e.g. C:\Web" & vbCrLf & vbCrLf & _
       "Note: Do NOT add '\' in the end of folder name!", "FLowercase Convertor", "C:\")

       If Input = "" Then
           MsgBox"Folder name is empty!", 48, "Error!"
           T = True
       Else T = False
       End If

   Wend

   MsgBox"All files names of " & Input & " will be converted to lowercase now", 64, "Note"
   fold(Input)
   MsgBox"Done! Total " & X & " file(s) were converted to lowercase.", 64, "Done"

   '--------------------------------------------------------------------------

   Sub fold(Path)
       Set f = fso.GetFolder(Path)
       Set rf = fso.GetFolder(Path).Files
       Set fc = f.SubFolders

       For Each fff In rf
           lcf1 = LCase(fso.GetAbsolutePathName(fff))
           fso.MoveFile fff, lcf1
           X = X + 1
       Next

       For Each f1 In fc
           fold(f1)
           Set File = fso.GetFolder(f1).Files

           For Each ff In File
               lcf = LCase(fso.GetAbsolutePathName(ff))
               fso.MoveFile ff, lcf
           Next

       Next

   End Sub


Click here to preview the VBScript Code Formatting Demo 1.

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!