[AU3]imail8.0的日志里邮箱出现shutdown后删除队列

编程入门 行业动态 更新时间:2024-10-11 17:19:54

[AU3]imail8.0的日志里邮箱出现shutdown后删除<a href=https://www.elefans.com/category/jswz/34/1771257.html style=队列"/>

[AU3]imail8.0的日志里邮箱出现shutdown后删除队列

#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=C:\WINDOWS\system32\SHELL32.dll
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
$g_szVersion = "qq153785587"
If WinExists($g_szVersion) Then
Exit
EndIf
AutoItWinSetTitle($g_szVersion)

$pathini = @ScriptDir & "\pathcfg.ini"

If Not FileExists($pathini) Then
$fileini = FileOpen($pathini, 2)
FileWrite($fileini, "[logpath]" & @CRLF)
FileWrite($fileini, "path=D:\IMail\spool" & @CRLF)
FileWrite($fileini, ";日志文件的路径 不要加\结尾" & @CRLF)
FileWrite($fileini, "qpath=f:\spool" & @CRLF)
FileWrite($fileini, ";队列存放路径 不要加\结尾" & @CRLF)
FileWrite($fileini, "time=5" & @CRLF)
FileWrite($fileini, ";单位是分钟" & @CRLF)
FileClose($fileini)
EndIf

$pathok = IniRead($pathini, "logpath", "path", "NotFound")
$qpathok = IniRead($pathini,"logpath","qpath","NotFound")
$pathtxt = $pathok & "\sys"& @MON & @MDAY & ".txt"
If Not FileExists($pathtxt) Then
WriteLog(False)
Exit
EndIf

$handle = FileOpen($pathtxt)
If $handle = -1 Then
WriteLog(False)
Exit
EndIf
$txt=FileRead($handle)
FileClose($handle)
$patern = ".*\((.*?)\).*shutdown started"
$chyn = StringRegExp($txt,$patern,0)
If $chyn Then
$array = StringRegExp($txt,$patern,3)
for $i = 0 to UBound($array) - 1
$querrypath = $qpathok & "\" & "*" & $array[$i] & "*"
If FileExists($querrypath) Then
RunWait(@ComSpec & " /c " & "net stop queuemgr","",0)
RunWait(@ComSpec & " /c " & "net stop smtpd32","",0)
Sleep(2000)
$PIDq = ProcessExists("queuemgr.exe")
If $PIDq Then ProcessClose($PIDq)
$PIDs = ProcessExists("smtpd32.exe")
If $PIDs Then ProcessClose($PIDs)
If FileDelete($querrypath) Then
WriteLog(True,$querrypath)
Else
WriteLog(True,$querrypath,0)
EndIf
RunWait(@ComSpec & " /c " & "net start queuemgr","",0)
RunWait(@ComSpec & " /c " & "net start smtpd32","",0)
EndIf
Next

EndIf


Func WriteLog($flag,$delname="NO",$success=1)
Local $logpath,$logpathtxt,$file,$temptime

$temptime = @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC
$logpath = @ScriptDir & "\log\" & @YEAR & "\" & @MON ;& @MDAY
If Not FileExists($logpath) Then
DirCreate($logpath)
EndIf
$logpathtxt = $logpath & "\" & @MDAY & ".txt"
$file = FileOpen ( $logpathtxt , 1 )
If $file <> -1 Then
If $flag Then
If $success Then
FileWrite($file,$temptime & " -Delete Filename Success : " & $delname & @CRLF)
Else
FileWrite($file,$temptime & " -Delete File Fail : " & $delname & @CRLF)
EndIf
Else
FileWrite($file, $temptime & " -Error Can't Find " &$pathtxt & " File." & @CRLF)
EndIf

EndIf

FileClose($file)

EndFunc


调用程序

#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=C:\WINDOWS\system32\SHELL32.dll|-115
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
$g_szVersion = "myqq153785587"
If WinExists($g_szVersion) Then
Exit
EndIf
AutoItWinSetTitle($g_szVersion)
HotKeySet("+!d", "EndLog") ;Shift-Alt-d

$delprocessname = "deletelog.exe"
$pathini = @ScriptDir & "\pathcfg.ini"

If Not FileExists($pathini) Then
$fileini = FileOpen($pathini, 2)
FileWrite($fileini, "[logpath]" & @CRLF)
FileWrite($fileini, "path=D:\IMail\spool" & @CRLF)
FileWrite($fileini, ";日志文件的路径 不要加\结尾" & @CRLF)
FileWrite($fileini, "qpath=f:\spool" & @CRLF)
FileWrite($fileini, ";队列存放路径 不要加\结尾" & @CRLF)
FileWrite($fileini, "time=5" & @CRLF)
FileWrite($fileini, ";单位是分钟" & @CRLF)
FileClose($fileini)
EndIf




While 1
$timem = IniRead(@ScriptDir & "\pathcfg.ini","logpath","time",5)
$timem = $timem*60000
;MsgBox(0,"",$timem)
Sleep($timem)
$PID = ProcessExists($delprocessname) ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
Run($delprocessname)
;delotherfile()
;$timetemp = @HOUR&@MIN
;If ($timetemp == "00:00") Then
delotherfile()
; Sleep(70000)
;EndIf
WEnd


Func delotherfile()
RunWait(@ComSpec & " /c " & "del /s /f /q d:\*.~bx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q e:\*.~bx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q f:\*.~bx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q d:\IMIP.mbx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q e:\IMIP.mbx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q f\IMIP.mbx","",0)
EndFunc



Func EndLog()
Exit 0
EndFunc

 

转载于:.html

更多推荐

[AU3]imail8.0的日志里邮箱出现shutdown后删除队列

本文发布于:2024-02-05 10:12:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1744660.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:队列   邮箱   日志   shutdown

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!