本帖最后由 afan 于 2009-7-21 01:06 编辑
头大了一圈……#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#NoTrayIcon
$Form1 = GUICreate('多层文件夹生成工具', 385, 125)
Dim $n = 1, $l[11], $s[11]
For $n = 1 To 10
$l[$n] = GUICtrlCreateLabel("第" & $n & "层", 12 + 74 * ($n - (Int(($n - 1) / 5)) * 5 - 1), 23 + 20 * (Int(($n - 1) / 5)), 37, 16)
$s[$n] = GUICtrlCreateInput("0", 46 + 74 * ($n - (Int(($n - 1) / 5)) * 5 - 1), 20 + 20 * (Int(($n - 1) / 5)), 30, 16, $ES_NUMBER)
GUICtrlSetLimit(-1, 4)
Next
$Button = GUICtrlCreateButton("生成文件夹(&G)", 80, 70, 190, 25)
$xs = GUICtrlCreateLabel("0/0", 290, 83, 80, 15)
GUICtrlSetColor(-1, 0x0000FF)
$jdt = GUICtrlCreateProgress(10, 100, 365, 12)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
exit
Case $Button
GUICtrlSetData($jdt, 0)
GUICtrlSetState($Button, $GUI_DISABLE)
Dim $ywc = 0, $zs = 0, $sc = 1
jc()
AdlibEnable("jdt")
If GUICtrlRead($s[1]) = 0 then
msgbox(48, '问题', '未设置文件夹数量? 请返回设置。 ')
Else
scml()
sleep(250)
AdlibDisable()
msgbox(64, '完成', '创建 ' & $zs & ' 个文件夹完成! ')
endif
GUICtrlSetState($Button, $GUI_ENABLE)
EndSwitch
WEnd
Func jc()
For $i = 10 To 1 Step -1
$sl = GUICtrlRead($s[$i])
If $sl > 0 then
For $i1 = 1 To $i
$sl1 = GUICtrlRead($s[$i1])
If $sl1 = 0 then
GUICtrlSetData($s[$i1], 1)
$sl1 = 1
endif
$zs = $zs + ($sc * $sl1)
$sc = $sc * $sl1
Next
ExitLoop
Endif
Next
EndFunc ;==>jc
Func scml()
$sl1 = GUICtrlRead($s[1])
For $i1 = 1 To $sl1
$fn1 = 'F'
DirCreate($fn1 & $i1)
$ywc = $ywc + 1
$sl2 = GUICtrlRead($s[2])
For $i2 = 1 To $sl2
$fn2 = $fn1 & $i1
DirCreate($fn2 & '\' & $fn2 & '-' & $i2)
$ywc = $ywc + 1
$sl3 = GUICtrlRead($s[3])
For $i3 = 1 To $sl3
$fn3 = $fn2 & '-' & $i2
DirCreate($fn2 & '\' & $fn3 & '\' & $fn3 & '-' & $i3)
$ywc = $ywc + 1
$sl4 = GUICtrlRead($s[4])
For $i4 = 1 To $sl4
$fn4 = $fn3 & '-' & $i3
DirCreate($fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn4 & '-' & $i4)
$ywc = $ywc + 1
$sl5 = GUICtrlRead($s[5])
For $i5 = 1 To $sl5
$fn5 = $fn4 & '-' & $i4
DirCreate($fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn5 & '-' & $i5)
$ywc = $ywc + 1
$sl6 = GUICtrlRead($s[6])
For $i6 = 1 To $sl6
$fn6 = $fn5 & '-' & $i5
DirCreate($fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn6 & '-' & $i6)
$ywc = $ywc + 1
$sl7 = GUICtrlRead($s[7])
For $i7 = 1 To $sl7
$fn7 = $fn6 & '-' & $i6
DirCreate($fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn7 & '\' & $fn7 & '-' & $i7)
$ywc = $ywc + 1
$sl8 = GUICtrlRead($s[8])
For $i8 = 1 To $sl8
$fn8 = $fn7 & '-' & $i7
DirCreate($fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn7 & '\' & $fn8 & '\' & $fn8 & '-' & $i8)
$ywc = $ywc + 1
$sl9 = GUICtrlRead($s[9])
For $i9 = 1 To $sl9
$fn9 = $fn8 & '-' & $i8
DirCreate($fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn7 & '\' & $fn8 & '\' & $fn9 & '\' & $fn9 & '-' & $i9)
$ywc = $ywc + 1
$sl10 = GUICtrlRead($s[10])
For $i10 = 1 To $sl10
$fn10 = $fn9 & '-' & $i9
DirCreate($fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn7 & '\' & $fn8 & '\' & $fn9 & '\' & $fn10 & '\' & $fn10 & '-' & $i10)
$ywc = $ywc + 1
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Endfunc ;==>scml
Func jdt()
GUICtrlSetData($jdt, $ywc / $zs * 100)
GUICtrlSetData($xs, $ywc & '/' & $zs)
EndFunc ;==>jdt
|