|
程序目前使用起来是没有任何问题的!
但是有几率的在服务器从起以后,程序打开以后不加载配置文件,配置文件存在但是不加载,希望各位帮忙
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=回写清理.exe|-1
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=新维科技 回写清理
#AutoIt3Wrapper_Res_Description=新维科技 回写清理
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=www.vxin.com
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Misc.au3>
opt("GUICloseOnESC",0)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 3)
If _Singleton("test", 1) = 0 Then
MsgBox(0, "错误", "程序已经在运行中,请不要重复运行", 5)
Exit
EndIf
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("新维科技清理回写", 255, 282)
$ListView1 = GUICtrlCreateListView("需要清理的目录", 0, 0, 170, 278)
$Button1 = GUICtrlCreateButton("添加路径", 176, 5, 75, 25)
$Button2 = GUICtrlCreateButton("删除路径", 176, 36, 75, 25)
$Button3 = GUICtrlCreateButton("自动启动", 176, 67, 75, 25)
If IniRead('Main.ini', 'Main', 'AutoRun', 0) = 1 Then
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'AutoClean', 'REG_EXPAND_SZ', @ScriptFullPath)
GUICtrlSetData(-1, '手动启动')
EndIf
$Button4 = GUICtrlCreateButton("启 动", 176, 98, 75, 25)
If IniRead('Main.ini', 'Main', 'AutoRun', 0) = 1 Then GUICtrlSetData(-1, '停 止')
$Button5 = GUICtrlCreateButton("退 出", 176, 129, 75, 25)
$input1 = GUICtrlCreateInput("", 175, 256, 75, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
GUICtrlSetData(-1, IniRead('Main.ini', 'Main', 'Time', 0))
$Label1 = GUICtrlCreateLabel("清理时间(秒)", 176, 237, 75, 17)
ReadListView()
GUISetState(@SW_SHOW)
Global $TrayMenu_Exit = TrayCreateItem("显示")
TrayItemSetOnEvent(-1, "_TrayMenuShowForm")
$TrayMenu_Exit = TrayCreateItem("退出")
TrayItemSetOnEvent(-1, "_TrayMenuExit")
TraySetState()
#endregion ### END Koda GUI section ###
$Time = IniRead('Main.ini', 'Main', 'Time', 60)
If IniRead('Main.ini', 'Main', 'AutoRun', 0) = 1 Then AdlibRegister('CleanPath', $Time * 1000)
While 1
IniWrite('Main.ini', 'Main', 'Time', GUICtrlRead($input1))
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button5
AdlibUnRegister('CleanPath')
Exit
Case $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE, $Form1)
Case $Button1
$Path = FileSelectFolder('请选择需要清理的目录', @DesktopDir, 1 + 2 + 4, '', $Form1)
If IniRead('Main.ini', 'CleanPath', $Path, 0) = 1 Then
MsgBox(48, '警告', '路径已在清理列表中', '', $Form1)
Else
IniWrite('Main.ini', 'CleanPath', $Path, 1)
EndIf
ReadListView()
Case $Button2
$ReadList = GUICtrlRead(GUICtrlRead($ListView1))
If $ReadList <> '' Then
$ListText = StringSplit($ReadList, '|')
IniDelete('Main.ini', 'CleanPath', $ListText[1])
ReadListView()
Else
MsgBox(48, '警告', '至少选择一个需要删除的路径', '', $Form1)
EndIf
Case $Button3
If GUICtrlRead($Button3) = '自动启动' Then
IniWrite('Main.ini', 'Main', 'AutoRun', 1)
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'AutoClean', 'REG_EXPAND_SZ', @ScriptFullPath)
GUICtrlSetData($Button3, '手动启动')
Else
IniWrite('Main.ini', 'Main', 'AutoRun', 0)
RegDelete('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'AutoClean')
GUICtrlSetData($Button3, '自动启动')
EndIf
Case $Button4
$Time = IniRead('Main.ini', 'Main', 'Time', 60)
If GUICtrlRead($Button4) = '启 动' Then
AdlibRegister('CleanPath', $Time * 1000)
GUICtrlSetData($Button4, '停 止')
Else
AdlibUnRegister('CleanPath')
GUICtrlSetData($Button4, '启 动')
EndIf
EndSwitch
WEnd
Func ReadListView()
GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
$ReadIni = IniReadSection('Main.ini', 'CleanPath')
If @error = 1 Then Return
For $i = 1 To $ReadIni[0][0]
GUICtrlCreateListViewItem($ReadIni[$i][0], $ListView1)
Next
EndFunc ;==>ReadListView
Func CleanPath()
$CleanPath = IniReadSection('Main.ini', 'CleanPath')
For $i = 1 To $CleanPath[0][0]
$FileCount = _FileListToArray($CleanPath[$i][0], '*.*', 1)
If Not @error Then
For $s = 1 To $FileCount[0]
$Filedelete = FileDelete($CleanPath[$i][0] & '\' & $FileCount[$s])
If $Filedelete = 1 Then
Else
EndIf
Next
EndIf
Next
;MsgBox(0, '', '清理成功')
EndFunc ;==>CleanPath
Func _TrayMenuExit()
AdlibUnRegister('CleanPath')
GUIDelete($Form1)
Exit
EndFunc ;==>_TrayMenuExit
Func _TrayMenuShowForm()
GUISetState(@SW_SHOW, $Form1)
EndFunc ;==>_TrayMenuShowForm |
|