楼主应该再多看看帮助,其实代码并不难。
多嘴勿怪。#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 315, 171, 215, 212)
$Button1 = GUICtrlCreateButton("开始", 192, 120, 49, 33)
$Button2 = GUICtrlCreateButton("退出", 255, 119, 49, 33)
$Label1 = GUICtrlCreateLabel("请选择核心目录:", 22, 34, 100, 25)
$Input1 = GUICtrlCreateInput("", 24, 64, 225, 21)
$Button3 = GUICtrlCreateButton("浏览", 264, 64, 33, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Dim $var, $ok
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_shanchu()
Case $Button2
Exit
Case $Button3
GUICtrlSetState($Button3, $GUI_DISABLE)
$var = FileSelectFolder("请选择目录:", "")
If @error Then
$var = GUICtrlRead($Input1)
Else
GUICtrlSetData($Input1, $var)
EndIf
GUICtrlSetState($Button3, $GUI_ENABLE)
GUICtrlSetBkColor($Input1, 0xFFFAF0)
EndSwitch
WEnd
Func _shanchu()
GUICtrlSetState($Button1, $GUI_DISABLE)
$lujing = $var & "\log"
If FileExists($lujing) Then
$search = FileFindFirstFile($lujing&"*.*")
If $search = -1 Then
MsgBox(0, "错误", "没有文件/目录 匹配搜索")
Exit
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
MsgBox(4096, "文件:", $lujing&$file);如果删除文件这行改为Filedelete($lujing&$file)
WEnd
FileClose($search)
Else
MsgBox(0,"警告","未找到LOG文件夹")
EndIf
EndFunc ;==>_shanchu
|