set wshell=createobject("wscript.shell")
Set fso=CreateObject("Scripting.FileSystemObject")
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "VBE Files|*.vbe|VBS File|*.vbs|all files|*.*"
objDialog.InitialDir = ""
for g=1 to 3
objDialog.ShowOpen
File = objDialog.FileName
if File<>"" then exit for
wrong
next
dim a(10000)
k=3
Set w=fso.OpentextFile(File,1)
do
s=w.readline
DC s
for z= 1 to k
s=" "&s
next
r=num(s)
k=r+k
if r=-3 then s=mid(s,3)
n=n+1
a(n)=s
if n>9999 then wrong
loop until w.atendofstream
Set w=fso.OpentextFile(File,2)
for q=1 to n
'w.writeline a(q)
next
sub wrong
u=wshell.popup("非法文件!"&chr(13)&chr(13)&"是否继续?",9,"wrong!",20)
if u=7 then wscript.quit
end sub
sub DC(byref s)
for e=1 to len(s)
if mid(s,e,1)<>" "then exit for
next
s=mid (s,e)
end sub
function num(ss)
x=ucase(split(ss," ")(3))
'msgbox "#"&x&"#"
IF x="DO" OR x="If" OR X="FOR" OR X="SUB" OR X="FUNCTION" OR X="WHILE" OR X="WITH" OR x="SELECT" THEN num=3
IF x="END" OR x="LOOP" OR x="NEXT" OR x="WEND" THEN num=-3
end function
找错呀,同志们...
这个VBS是用来进行缩进处理的
可是现在只能达到一边齐的效果
真是要死....
Set fso=CreateObject("Scripting.FileSystemObject")
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "VBE Files|*.vbe|VBS File|*.vbs|all files|*.*"
objDialog.InitialDir = ""
for g=1 to 3
objDialog.ShowOpen
File = objDialog.FileName
if File<>"" then exit for
wrong
next
dim a(10000)
k=3
Set w=fso.OpentextFile(File,1)
do
s=w.readline
DC s
for z= 1 to k
s=" "&s
next
r=num(s)
k=r+k
if r=-3 then s=mid(s,3)
n=n+1
a(n)=s
if n>9999 then wrong
loop until w.atendofstream
Set w=fso.OpentextFile(File,2)
for q=1 to n
'w.writeline a(q)
next
sub wrong
u=wshell.popup("非法文件!"&chr(13)&chr(13)&"是否继续?",9,"wrong!",20)
if u=7 then wscript.quit
end sub
sub DC(byref s)
for e=1 to len(s)
if mid(s,e,1)<>" "then exit for
next
s=mid (s,e)
end sub
function num(ss)
x=ucase(split(ss," ")(3))
'msgbox "#"&x&"#"
IF x="DO" OR x="If" OR X="FOR" OR X="SUB" OR X="FUNCTION" OR X="WHILE" OR X="WITH" OR x="SELECT" THEN num=3
IF x="END" OR x="LOOP" OR x="NEXT" OR x="WEND" THEN num=-3
end function
找错呀,同志们...
这个VBS是用来进行缩进处理的
可是现在只能达到一边齐的效果
真是要死....