#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include<file.au3>
#include <array.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 369, 251, 192, 114, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_WINDOWEDGE))
$Form1context = GUICtrlCreateContextMenu()
$MenuItem1 = GUICtrlCreateMenuItem("清空", $Form1context)
$Group1 = GUICtrlCreateGroup("Group1", 0, 8, 361, 153)
$Label1 = GUICtrlCreateLabel("路径:", 8, 40, 48, 17)
$Label2 = GUICtrlCreateLabel("文件名:", 8, 80, 52, 17)
$Input1 = GUICtrlCreateInput("", 64, 32, 209, 28)
GUICtrlSetState(-1, $GUI_ACCEPTFILES)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 64, 72, 209, 28)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("浏览", 288, 32, 65, 25)
$Button1context = GUICtrlCreateContextMenu($Button1)
$Label3 = GUICtrlCreateLabel("数量:", 8, 120, 40, 17)
$Input3 = GUICtrlCreateInput("", 64, 112, 73, 28)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Combo1 = GUICtrlCreateCombo("", 280, 72, 73, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $CBS_SIMPLE))
GUICtrlSetData(-1, ".txt|.jpg|.doc|.xls|.exe")
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("批量创建", 56, 176, 257, 65)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$files = FileSelectFolder("选择相应文件夹", @WorkingDir)
GUICtrlSetData($Input1, $files)
Case $Button2
$way = GUICtrlRead($Input1)
$name = GUICtrlRead($Input2)
$style = GUICtrlRead($Combo1)
_FileAndDirCreate($way & "\" & $name & $style)
Case $MenuItem1
GUICtrlSetData($Input1, "")
EndSwitch
WEnd
Func _FileAndDirCreate($FilePach)
Dim $szDrive, $szDir, $szFName, $szExt
$arrPath = _PathSplit($FilePach, $szDrive, $szDir, $szFName, $szExt)
If Not FileExists($FilePach) Then
If $szExt = '' Then
;~ DirCreate($FilePach)
Else
;~ _FileCreate($FilePach)
EndIf
Else
Local $str
Local $len = StringLen(GUICtrlRead($Input3))
For $i = 1 To GUICtrlRead($Input3)
$str &= $FilePach & StringFormat('%0' & $len & 'd', $i) & @CRLF
Next
MsgBox(0, 0, $str)
EndIf
EndFunc ;==>_FileAndDirCreate
|