#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_icon=..\..\..\..\..\..\Windows\syswow64\SHELL32.dll|-161
#PRE_Outfile=QQ资料性别筛选工具最后更新版.exe
#PRE_UseUpx=n
#PRE_UseX64=n
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <Constants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Misc.au3>
#include<file.au3>
#include <Array.au3>
If _Singleton(@ScriptName, 1) = 0 Then
MsgBox(64, "温馨提醒", "您只能运行一个此应用程序!")
Exit (1)
EndIf
Global $girl = 0
$Form1 = GUICreate("QQ资料性别筛选工具", 430, 320, -1, -1)
GUISetBkColor(0xCCCCFF)
$Input1 = GUICtrlCreateInput("", 10, 14, 260, 25)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
$Label2 = GUICtrlCreateLabel("性别:", 10, 85, 50, 20)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
$Input2 = GUICtrlCreateInput("", 60, 250, 110, 25)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
$Label2 = GUICtrlCreateLabel("账号:", 10, 255, 50, 20)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
$Input3 = GUICtrlCreateInput("", 250, 250, 150, 25)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
$Label2 = GUICtrlCreateLabel("密码:", 200, 255, 50, 20)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
$Button1 = GUICtrlCreateButton("选择文本", 298, 13, 112, 28)
GUICtrlSetFont(-1, 12, 400, 0, "黑体")
GUICtrlSetColor(-1, 0x0000FF)
$Button2 = GUICtrlCreateButton("开始筛选", 298, 70, 112, 40)
GUICtrlSetFont(-1, 12, 400, 0, "黑体")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetState(-1, $GUI_DISABLE)
;MsgBox(0,0,GUICtrlRead($Input3))
$Combo2 = GUICtrlCreateCombo("女", 60, 80, 80, 25)
GUICtrlSetData(-1, "男")
GUICtrlSetFont(-1, 11, 0, 0, "黑体")
GUISetState()
_ReduceMemory(@AutoItPID)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Local $odialog = FileOpenDialog("选择一个文本,该文本格式为每行一个QQ", @DesktopDir & "", "文本文件 (*.txt)", 1)
If @error Then
MsgBox(4096, "提示:", "没有选择文件!")
Else
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetData($Input1, $odialog)
EndIf
Case $Button2 ;每运行9次清理一次内存,Mod(0,9)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Button1, $GUI_DISABLE)
Local $gender = GUICtrlRead($Combo2)
Local $ahang = _FileCountLines(GUICtrlRead($Input1))
Local $QQNUM = GUICtrlRead($Input2)
Local $QQPWD = GUICtrlRead($Input3)
Local $aRecords
If Not _FileReadToArray(GUICtrlRead($Input1), $aRecords) Then
MsgBox(64, "错误提示:", "找不到导入的文本,请重新导入!" & @error)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Button1, $GUI_ENABLE)
Else
;If $times > 1 Then
;Local $Asktime=MsgBox(4,"继续上次操作","")
Run(@ScriptDir & "\Runtimes\QQ资料查询主界面.exe");运行
While 1
Sleep(200)
Local $tittle = ControlGetText("好友资料查询主界面", "", "[NAME:button3]")
If $tittle == "查询资料" Then ExitLoop
WEnd
;输入账号密码并登录和查询
ControlSetText("好友资料查询主界面", "", "[NAME:textBox1]", $QQNUM)
Sleep(200)
ControlSetText("好友资料查询主界面", "", "[NAME:textBox2]", $QQPWD)
Sleep(200)
ControlClick("好友资料查询主界面", "", "[NAME:button1]", "left", 1)
Sleep(200)
While 1
Sleep(10000)
Local $logstatus = ControlTreeView("好友资料查询主界面", "", "[NAME:treeView1]", "GetItemCount")
If $logstatus <> 0 Then
ExitLoop
Else
ControlSend("[CLASS:WindowsForms10.Window.8.app.0.378734a]", "", "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:2]", "C",1)
Sleep(3000)
ControlClick("好友资料查询主界面", "", "[NAME:button1]", "left", 1)
EndIf
WEnd
$Label2 = GUICtrlCreateLabel("当前QQ: " & $ahang & "个,程序运行中,请勿关闭!", 10, 138, 300, 20)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
GUICtrlSetColor(-1, 0x0000FF)
;GUICtrlSetState($Combo2, $GUI_DISABLE)
Dim $file = FileOpen(@ScriptDir & "" & $gender & "-" & @MIN & @SEC & ".txt", 1)
;开始操作查询
;Local $times = IniRead(@ScriptDir & "\Runtimes\config.ini", "setup", "times", "1")
$Label22 = GUICtrlCreateLabel("", 10, 168, 300, 20)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
GUICtrlSetColor(-1, 0xff0043)
$Label23 = GUICtrlCreateLabel("", 10, 198, 300, 20)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
GUICtrlSetColor(-1, 0x0000FF)
For $x = 1 To $ahang
GUICtrlSetData($Label22,"正在筛选第" & $x & "个,请稍后....")
ControlSetText("好友资料查询主界面", "", "[NAME:textBox3]", $aRecords[$x]); 输入QQ号
Sleep(250)
ControlClick("好友资料查询主界面", "", "[NAME:button3]", "left", 1);点击查询资料
Local $cb = 1
While 1
Sleep(250)
Local $text = ControlGetText("好友资料查询主界面", "", "[NAME:richTextBox1]")
If $text <> "" Then
ExitLoop
Else
ControlClick("好友资料查询主界面", "", "[NAME:button3]", "left", 1)
$cb = $cb +1
EndIf
If $cb = 8 Then
_continue()
ControlSetText("好友资料查询主界面", "", "[NAME:textBox3]", $aRecords[$x]); 输入QQ号
Sleep(1000)
ControlClick("好友资料查询主界面", "", "[NAME:button3]", "left", 1);点击查询资料
EndIf
If WinExists("[CLASS:WindowsForms10.Window.8.app.0.378734a]","如果单击") Then
_continue()
ControlSetText("好友资料查询主界面", "", "[NAME:textBox3]", $aRecords[$x]); 输入QQ号
Sleep(1000)
ControlClick("好友资料查询主界面", "", "[NAME:button3]", "left", 1);点击查询资料
EndIf
WEnd
If StringInStr($text, $gender & $aRecords[$x]) Then
FileWriteLine($file, $aRecords[$x])
$girl = $girl + 1
GUICtrlSetData($Label23,"已有" & $girl & "个符合条件!")
EndIf
ControlSetText("好友资料查询主界面", "", "[NAME:richTextBox1]", ""); 清空消息的文本
If Mod($x, 9) = 0 Then
Clear_Memory();9次清理一回内存
EndIf
Next
FileClose($file)
$Label2 = GUICtrlCreateLabel("", 10, 198, 300, 20)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
GUICtrlSetColor(-1, 0x0000FF)
$Label2 = GUICtrlCreateLabel("", 10, 168, 300, 20)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
GUICtrlSetColor(-1, 0xff0043)
$Label2 = GUICtrlCreateLabel("全部筛选完毕,请及时备份结果!", 10, 138, 300, 20)
GUICtrlSetFont(-1, 11, 400, 0, "黑体")
GUICtrlSetColor(-1, 0x0000FF)
EndIf
EndSwitch
WEnd
; Clear_Memory();清理内存
Func _continue()
ProcessClose("QQ资料查询主界面.exe")
ProcessClose("QQ资料查询主界面.exe")
While 1
Sleep(200)
Local $cs = ProcessExists("QQ资料查询主界面.exe")
If $cs <> 0 Then
ProcessClose("QQ资料查询主界面.exe")
ElseIf $cs = 0 Then
ExitLoop
EndIf
WEnd
;Local $Retimes = IniRead(@ScriptDir & "\Runtimes\config.ini", "setup", "times", "") + 1
Local $reQQ = GUICtrlRead($Input2)
Local $rePWD = GUICtrlRead($Input3)
Sleep(30000)
Clear_Memory()
Run(@ScriptDir & "\Runtimes\QQ资料查询主界面.exe");运行
Sleep(3000)
While 1
Sleep(200)
Local $tittle1 = ControlGetText("好友资料查询主界面", "", "[NAME:button3]")
If $tittle1 == "查询资料" Then ExitLoop
WEnd
;输入账号密码并登录和查询
ControlSetText("好友资料查询主界面", "", "[NAME:textBox1]", $reQQ)
Sleep(200)
ControlSetText("好友资料查询主界面", "", "[NAME:textBox2]", $rePWD)
Sleep(200)
ControlClick("好友资料查询主界面", "", "[NAME:button1]", "left", 1)
Sleep(200)
While 1
Sleep(10000)
Local $logstatus1 = ControlTreeView("好友资料查询主界面", "", "[NAME:treeView1]", "GetItemCount")
If $logstatus1 <> 0 Then
ExitLoop
Else
ControlSend("[CLASS:WindowsForms10.Window.8.app.0.378734a]", "", "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:2]", "C",1)
Sleep(3000)
ControlClick("好友资料查询主界面", "", "[NAME:button1]", "left", 1)
EndIf
WEnd
EndFunc ;==>_continue
Func Clear_Memory()
Local $i, $mem = MemGetStats()
Local $MemGet1 = $mem[2]
Local $ProcessList = ProcessList()
For $i = 1 To $ProcessList[0][0]
_ReduceMemory($ProcessList[$i][1])
Next
$mem = MemGetStats()
Local $MemGet2 = $mem[2]
Local $Memory = ($MemGet2 - $MemGet1) / 1024
EndFunc ;==>Clear_Memory
Func _ReduceMemory($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
附上源码如上,前2000次基本每秒一次,越往后就有点慢。好友资料查询主界面这个程序就不提供,因为这个程序不是au3写的,经常出错,If WinExists("[CLASS:WindowsForms10.Window.8.app.0.378734a]","如果单击") 这一句就是判断出错的,_continue()用来重启好友资料查询主界面这个程序。