本帖最后由 jycel 于 2010-6-16 22:29 编辑
6-16发现一个新问题
在网吧使用过程中,发现有个别QQ用户无昵称(全是空格),这里不是程序问题,如果新手的话最好在读取时加个判断,免得造成在向服务端发送时产生错误,我当时忘了加判断,一直在提示数组错误,后面才查出是没得昵称的原因
……………………………………………………………………………………………………………………………………
我改了下写到配置文件中去以便程序调用
number为共读取了多少个号 date值自己去分割 别忘了读取内容后将文件删除,免得像网吧用户在读取客户机时,让顾客抓住把柄呵呵#include <Array.au3>
#include <GUIToolbar.au3>
Dim $qqini=@ScriptDir&"\dir.ini"
If FileExists($qqini) Then FileDelete($qqini)
If Not ProcessExists("qq.exe") Then
IniWrite($qqini,"Temp","Number","0")
IniWrite($qqini,"Temp","date","查询失败本机未成功登陆QQ")
Exit
EndIf
QQInfo()
$var=IniReadSectionNames($qqini)
IniWrite($qqini,"Temp","Number",$var[0])
For $i=1 To $var[0]
$j = IniRead($qqini, "Temp","date","")
If $i = 1 Then IniWrite($qqini, "Temp","date", IniRead($qqini,$var[$i],$var[$i],""))
If $i > 1 Then IniWrite($qqini, "Temp","date", $j & "|" &IniRead($qqini,$var[$i],$var[$i],""))
Next
For $d =$var[0] To 1 Step -1
IniDelete($qqini,$var[$d])
Next
Func QQInfo()
Local $info[1][2], $sR, $i, $i_C, $txt
Local $hTb = ControlGetHandle('[class:Shell_TrayWnd]', '', 'ToolbarWindow321')
For $i = 0 To _GUICtrlToolbar_ButtonCount($hTb) - 1
$i_C = _GUICtrlToolbar_IndexToCommand($hTb, $i)
$txt = _GUICtrlToolbar_GetButtonText($hTb, $i_C)
$sR = StringRegExp($txt, '^QQ\:\h(.+)\((\d{5,}|.+@.+)\)', 3)
If Not @error Then
$info[0][0] += 1
ReDim $info[$info[0][0] + 1][2]
$info[$info[0][0]][0] = $sR[1]
$info[$info[0][0]][1] = $sR[0]
IniWrite($qqini,$info[0][0],$info[0][0],$sR[1]&"~!@#$"&$sR[0])
EndIf
Next
Return $info
EndFunc ;==>QQInfo
|