按键精灵QQ群成员消息群发思路和脚本(For QQ7.9轻聊版)





一、QQ群成员消息群发思路

问题一:怎么打开所有QQ群成员聊天窗口?

思路:鼠标选定任一个QQ群成员,然后从这个位置开始,双击鼠标->按一下↓键->鼠标下移20像素,如此循环,当鼠标坐标y值大于QQ群窗口右下角坐标y值鼠标不再移动,双击鼠标->按一下↓键,如此循环。

问题二:怎么判断已经移到最后一个QQ群成员?

思路:每次选中一个QQ群成员,截一下屏,若和上一次截屏一样,说明已经移到最后一个QQ群成员。

二、按键精灵QQ群成员消息群发脚本

/********************************
单个QQ群成员群发消息(先设置QQMessage的值)
********************************/

Delay 5000 //延时5秒供激活QQ群窗口

Dim QQMessage : QQMessage = "在吗?"//要发送的QQ消息
Dim QQHwnd : QQHwnd = Plugin.Window.Foreground() //QQ群窗口句柄
Dim ArrRect : ArrRect = Split(Plugin.Window.GetClientRect(QQHwnd), "|") //QQ群窗口坐标
Dim QQX1 : QQX1 = Clng(ArrRect(0)) //QQ群窗口坐标x1
Dim QQY1 : QQY1 = Clng(ArrRect(1)) //QQ群窗口坐标y1
Dim QQX2 : QQX2 = Clng(ArrRect(2)) //QQ群窗口坐标x2
Dim QQY2 : QQY2 = Clng(ArrRect(3))//QQ群窗口标y2
Plugin.Window.Top QQHwnd,0 //置顶窗口
Dim X, Y : GetCursorPos X, Y //鼠标位置    
Dim PrintX1 : PrintX1 = QQX2-200 //截屏区域坐标x1
Dim PrintY1 : PrintY1 = Y //截屏区域坐标y1
Dim PrintX2 : PrintX2 = QQX2-140 //截屏区域坐标x2
Dim PrintY2 : PrintY2 = QQY2//截屏区域坐标y2
Dim PrintFile : PrintFile = Plugin.Sys.GetDir(0) + "\screen.bmp"//截屏图片保存路径
Plugin.Pic.PrintScreen PrintX1, PrintY1, PrintX2, PrintY2, PrintFile //保存截屏
Dim QQList : QQList = Replace("|{0}|", "{0}", Plugin.Window.SearchEx("TXGuiFoundation", 0, 0))//已打开QQ窗口句柄列表
Dim TmpQQList, TmpQQHwnd, TmpQQText, i

KeyPress "Up", 1
Delay 1500
KeyPress "Down", 1


/*** 第一步:逐个打开QQ群成员聊天窗口 ***/


Do
    //打开选中的QQ群成员
    LeftDoubleClick 1
    Delay 1500
    //移到下一个QQ群成员
    Plugin.Window.Active QQHwnd
    Plugin.Window.Move QQHwnd, QQX1, QQY1
    KeyPress "Down", 1
    If (Y + 25) < QQY2 Then
        MoveTo X, Y + 20
        GetCursorPos X, Y
    Else
        MoveTo X, Y
    End If
    LeftClick 1
    //根据截屏判断是否已到末尾
    If Plugin.Pic.FindPic(PrintX1-5, PrintY1-5, PrintX2+5, PrintY2+5, PrintFile, 0, 0.8)="-1|-1" Then
        Plugin.Pic.PrintScreen PrintX1, PrintY1, PrintX2, PrintY2, PrintFile
    Else
        Exit Do
    End If
Loop While True    
Plugin.Window.Top QQHwnd, 1
    
    
/*** 第二步:逐个QQ群成员发送消息 ***/


TmpQQList = Split(Plugin.Window.SearchEx("TXGuiFoundation", 0, 0), "|")
If UBound(TmpQQList)>=0 Then
    i=0
    For UBound(TmpQQList)
        TmpQQHwnd = Clng(TmpQQList(i))
        TmpQQText = Plugin.Window.GetText(TmpQQHwnd)
        If Instr(QQList, Replace("|{0}|", "{0}", TmpQQHwnd)) = 0 And TmpQQText <> "" And TmpQQText <> "TXMenuWindow" And TmpQQText <> "QQ" Then
            TracePrint TmpQQText
            Plugin.Window.Restore TmpQQHwnd
            Plugin.Window.Active TmpQQHwnd
            Plugin.Window.SendString TmpQQHwnd, QQMessage
            KeyPress 13, 1 //按Enter
            KeyDown 17, 1 //按Ctrl+Enter
            KeyPress 13, 1
            KeyUp 17, 1
            Delay 1000
            KeyDown 18, 1 //用Alt+F4关闭聊天窗口(Plugin.Window.Close会关闭整个QQ)
            KeyPress 115, 1
            KeyUp 18, 1
        End If
        i=i+1
    Next
End If    

MessageBox "QQ群成员消息发送结束"


评论: 0 | 引用: 0 | 查看次数: 405
发表评论
登录后再发表评论!