level 6
jirachiibaby
楼主
option explicit
'On Error Resume Next
Dim wsfso, dicname
Dim maxlength, dictype
Const ForAppending = 8
Set wsfso = Wscript.createobject("scripting.filesystemobject")
maxlength=inputbox("Please input the max length of your dic.")
If Not isnumeric(maxlength) Then
msgbox "Error, Must be a number."
wscript.quit
End If
dictype=inputbox("Select create-type:" & vbcrlf & "'w' for words" & vbcrlf & "'n' for number" & vbcrlf & "'a' for all-ascii")
createdic '-----------------------------------------------------------------------------------------------
Sub createdic
If wsfso.FileExists("Defaltdic.txt") Then
dicname = inputbox("Defaltdic.txt already existed. Please input custom name")
If Right(dicname,4) <> ".txt" Then
dicname = dicname & ".txt"
wsfso.createtextfile(dicname)
End If
Else
dicname = "Defaltdic.txt"
wsfso.createtextfile("Defaltdic.txt")
End If
type1
End Sub
'------------------------------------------------------------------------------------------------
Function zeroadd (a)
Dim zn
zn = "0"
Do Until Len(zn) = maxlength - Len(a)
If Len(a) = maxlength Then
a = a
Exit Do
End If
zn = zn & zn
Loop
a = zn & a
End Function
'-----------------------------------------------------------------------------------------------
function type1
Dim a,dic
a="0"
Set dic = wsfso.opentextfile(dicname,ForAppending,false)
Do
If maxlength < Len(a) Then Exit Do
dic.writeline(a)
'dic.writeline(zeroadd(a))
a=CDbl(a)
a=CStr(a + 1)
Loop
dic.close
End Function
'------------------------------------------------------------------------------------------------
之前折腾了半天,opentxtfile报错,好不容易解决了又停不下来了……
执行到function type1这个函数中的do循环的时候就开始死循环了!
谁能来告诉我哪儿不对劲了啊……
顺带提一下,不是VB6.0,是以Wscript 运行的VBS
2013年03月10日 06点03分
1
'On Error Resume Next
Dim wsfso, dicname
Dim maxlength, dictype
Const ForAppending = 8
Set wsfso = Wscript.createobject("scripting.filesystemobject")
maxlength=inputbox("Please input the max length of your dic.")
If Not isnumeric(maxlength) Then
msgbox "Error, Must be a number."
wscript.quit
End If
dictype=inputbox("Select create-type:" & vbcrlf & "'w' for words" & vbcrlf & "'n' for number" & vbcrlf & "'a' for all-ascii")
createdic '-----------------------------------------------------------------------------------------------
Sub createdic
If wsfso.FileExists("Defaltdic.txt") Then
dicname = inputbox("Defaltdic.txt already existed. Please input custom name")
If Right(dicname,4) <> ".txt" Then
dicname = dicname & ".txt"
wsfso.createtextfile(dicname)
End If
Else
dicname = "Defaltdic.txt"
wsfso.createtextfile("Defaltdic.txt")
End If
type1
End Sub
'------------------------------------------------------------------------------------------------
Function zeroadd (a)
Dim zn
zn = "0"
Do Until Len(zn) = maxlength - Len(a)
If Len(a) = maxlength Then
a = a
Exit Do
End If
zn = zn & zn
Loop
a = zn & a
End Function
'-----------------------------------------------------------------------------------------------
function type1
Dim a,dic
a="0"
Set dic = wsfso.opentextfile(dicname,ForAppending,false)
Do
If maxlength < Len(a) Then Exit Do
dic.writeline(a)
'dic.writeline(zeroadd(a))
a=CDbl(a)
a=CStr(a + 1)
Loop
dic.close
End Function
'------------------------------------------------------------------------------------------------
之前折腾了半天,opentxtfile报错,好不容易解决了又停不下来了……
执行到function type1这个函数中的do循环的时候就开始死循环了!
谁能来告诉我哪儿不对劲了啊……
顺带提一下,不是VB6.0,是以Wscript 运行的VBS