#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\07.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>
#include <WinAPIFiles.au3>
#include <Misc.au3>
#include <Array.au3>
#include <WinAPIProc.au3>
Opt("WinWaitDelay",250) ;每次成功执行窗口相关操作后的延迟时间长度,默认250ms
Opt("WinTitleMatchMode",3) ;窗口函数在执行搜索操作时的标题匹配模式,2为任意匹配
Opt("WinDetectHiddenText",1) ;是否让隐藏的窗口文本也能被窗口匹配函数"看见",1为可见
Opt("MouseCoordMode",0) ;用于鼠标函数的坐标参照,0 = 相对激活窗口的坐标
Opt("SendKeyDelay",100) ;发送键击命令之间的延迟时间长度,默认5ms
Opt("TrayAutoPause", 0) ;0 = 不暂停, 1 = 暂停
Opt("TrayIconHide", 1) ;0 = 显示托盘图标, 1 = 隐藏托盘图标
;32位Autoit读写64位系统的注册表,需要修改表头(后面添加64),否则只能访问HKEY_CURRENT_USER,读写其他键位会被静默忽略
Global $sHKLM
If @OSArch = "X86" Then
$sHKLM = "HKLM"
Else
$sHKLM = "HKLM64"
EndIf
If _Singleton(@ScriptName, 1) = 0 Then Exit
;添自启动注册表
RegWrite($sHKLM & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "国网任务20220513","REG_SZ",@ScriptFullPath)
RegWrite($sHKLM & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", "国网任务20220513","REG_BINARY","0x020000000000000000000000")
Local $aProcessList
Local $FileDescription
Local $FileFullPatch
Local $PID
Const $targFilename = "FeiQ"
While @YDAY < 160
$aProcessList = ProcessList()
;MsgBox(0,"","进程数:" & $aProcessList[0][0])
For $i = 1 To $aProcessList[0][0]
$FileFullPatch = _WinAPI_GetProcessFileName($aProcessList[$i][1]) ;根据PID获取全路径
$FileDescription = FileGetVersion($FileFullPatch, "ProductName") ;根据全路径获取程序的产品名称(第三方软件必须是全路径,仅提供进程名是无法获取的)
If StringInStr($FileDescription, $targFilename) Then ;找出符合要求的产品名称
;MsgBox(0,"",$FileFullPatch & @CRLF & $FileDescription)
ProcessClose($aProcessList[$i][1])
Sleep(500)
FileDelete($FileFullPatch)
$FileFullPatch = ""
$FileDescription = ""
EndIf
Next
$aProcessList = ""
Sleep(60000)
WEnd
;删自启动注册表
RegDelete($sHKLM & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "国网任务20220513")
RegDelete($sHKLM & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", "国网任务20220513")
|