|
VBScriptスクリプト言語のソースコード整形例 |
|
|
|
|
|
SourceFormatX は優れた構文解析エンジンを元に作られています。ですのであらゆるスタイルで書かれたソースコードを美しく整形することができます。以下の例のようなめちゃくちゃなコードでさえも、整形することが可能です。
|
これは極端な例ですが。SourceFormatXに搭載されている強力な VBScript / VBS スクリプト言語 のパーサーエンジンの実力を感じて頂けるかと思います。
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:\Webmaster"&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
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:\Webmaster" & 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
再び手動でVBScript言語のソースコードを整形するために時を浪費しないで下さい! SourceFormatX体験版の無料ダウンロード!
|