#include <Misc.au3>
#include <Process.au3>
#include <WinAPI.au3>
#include <WinAPIProc.au3>
#include <WinAPIFiles.au3>
AdlibRegister("_ReduceMemory", 120000);每过120秒释放一次内存
local $key = "【自我检测多发是否重复】";检测文件是否重复运行,多个检测必须标签不同
If WinExists($key) Then
Exit
Endif
Sleep(200)
HotKeySet("!^{x}", '_Exit') ;退出快捷键为Ctrl+ALT+x键
MsgBox(0, "", '程序已开始运行,退出快捷键为Ctrl+ALT+x键', 3)
Local $unfile = @ScriptDir & "\timec.ini"
While 1
If FileExists($unfile) Then
Local $tim = @HOUR & ':' & @MIN
file_read()
fas()
Else
file_write()
Sleep(1000);1000 等于1秒
_Exit()
EndIf
WEnd
Func file_read()
If FileExists ($unfile) Then
Global $unmes1 = IniRead("timec.ini", "参数", "对象名1", "$unmes1")
Global $unmes2 = IniRead("timec.ini", "参数", "对象名2", "$unmes2")
Global $time1 = IniRead("timec.ini", "参数", "时间1", "time1")
Global $time2 = IniRead("timec.ini", "参数", "时间2", "time2")
Global $time3 = IniRead("timec.ini", "参数", "时间3", "time3")
Global $time4 = IniRead("timec.ini", "参数", "时间4", "time4")
Global $time5 = IniRead("timec.ini", "参数", "时间5", "time5")
Global $time6 = IniRead("timec.ini", "参数", "时间6", "time6")
Global $str1 = IniRead("timec.ini", "参数", "时间1语句", "str1")
Global $str2 = IniRead("timec.ini", "参数", "时间2语句", "str2")
Global $str3 = IniRead("timec.ini", "参数", "时间3语句", "str3")
Global $str4 = IniRead("timec.ini", "参数", "时间4语句", "str4")
Global $str5 = IniRead("timec.ini", "参数", "时间5语句", "str5")
Global $str6 = IniRead("timec.ini", "参数", "时间6语句", "str6")
Else
file_write()
EndIf
EndFunc
Func file_write()
IniWrite(@ScriptDir & "\timec.ini", "参数", "对象名1", "需要发给谁,不要有特殊符号")
IniWrite(@ScriptDir & "\timec.ini", "参数", "对象名2", "需要发给谁,不要有特殊符号")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间1", "发送时间请用时:分表示比如16:30")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间2", "发送时间请用时:分表示比如16:30")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间3", "发送时间请用时:分表示比如16:30")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间4", "发送时间请用时:分表示比如16:30")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间5", "发送时间请用时:分表示比如16:30")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间6", "发送时间请用时:分表示比如16:30")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间1语句", "需要推送的语句,不要有回车")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间2语句", "需要推送的语句,不要有回车")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间3语句", "需要推送的语句,不要有回车")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间4语句", "需要推送的语句,不要有回车")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间5语句", "需要推送的语句,不要有回车")
IniWrite(@ScriptDir & "\timec.ini", "参数", "时间6语句", "需要推送的语句,不要有回车")
MsgBox(0, "", '读取配置,请检查并修改配置文件.', 5)
ShellExecute("timec.ini", "", @ScriptDir, "edit") ; 记事本打开配置文件并允许编辑
EndFunc
Func fas()
For $i = 1 To 1
If $tim = $time1 Then
Global $strn = $str1
ClipPut($strn)
$strn = ClipGet()
_Wechat_AutoSend()
;MsgBox(64,"测试",""&$tim&$time1&$strn&"",0)
Sleep(50000)
EndIf
If $tim = $time2 Then
Global $strn = $str2
ClipPut($strn)
$strn = ClipGet()
_Wechat_AutoSend()
;MsgBox(64,"测试",""&$tim&$time2&$strn&"",0)
Sleep(32000)
EndIf
If $tim = $time3 Then
Global $strn = $str3
ClipPut($strn)
$strn = ClipGet()
_Wechat_AutoSend()
;MsgBox(64,"测试",""&$tim&$time3&$strn&"",0)
Sleep(50000)
EndIf
If $tim = $time4 Then
Global $strn = $str4
ClipPut($strn)
$strn = ClipGet()
_Wechat_AutoSend()
;MsgBox(64,"测试",""&$tim&$time3&$strn&"",0)
Sleep(50000)
EndIf
If $tim = $time5 Then
Global $strn = $str5
ClipPut($strn)
$strn = ClipGet()
_Wechat_AutoSend()
;MsgBox(64,"测试",""&$tim&$time3&$strn&"",0)
Sleep(50000)
EndIf
If $tim = $time6 Then
Global $strn = $str6
ClipPut($strn)
$strn = ClipGet()
_Wechat_AutoSend()
;MsgBox(64,"测试",""&$tim&$time3&$strn&"",0)
_exit()
EndIf
Next
EndFunc ;==>fas
Func _Exit()
Exit
EndFunc ;==>ext
Func _Wechat_AutoSend()
Send("^!z") ;激活微信窗口快捷键
Local $hHwnd = WinWaitActive("[CLASS:WeChatMainWndForPC]")
SendKeepActive($hHwnd)
Send("^f")
Send($unmes1)
Sleep(500)
Send("{Enter}")
SendKeepActive("")
$hHwnd = WinWait("[CLASS:WeChatMainWndForPC]", $unmes1, 3)
SendKeepActive($hHwnd)
;Send($strn)
Send("^v")
Sleep(1000)
Send("!s")
SendKeepActive("")
Send("^f")
Send($unmes2)
Sleep(1000)
Send("{Enter}")
SendKeepActive("")
$hHwnd = WinWait("[CLASS:WeChatMainWndForPC]", $unmes2, 3)
SendKeepActive($hHwnd)
;Send($strn)
Send("^v")
Sleep(1000)
Send("!s")
SendKeepActive("")
Send("^!z") ;激活微信窗口快捷键
EndFunc ;==>_Wechat_AutoSend
Func _ReduceMemory();//脚本内存释放
Local $i_PID = @AutoItPID
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc ;==>_ReduceMemory