找回密码
 加入
搜索
查看: 1637|回复: 2

如何发送对脚本自身托盘图标的点击事件

[复制链接]
发表于 2010-2-2 16:52:58 | 显示全部楼层 |阅读模式
本帖最后由 afan 于 2010-2-2 23:32 编辑

我写了个脚本,运行一段代码后想让它暂停,想利用脚本自身的暂停功能, 就是点击一下托盘图标,显示一个红叉, 脚本已暂停,在程序中应该如何实现这个点击?

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

 楼主| 发表于 2010-2-2 23:03:58 | 显示全部楼层
自行解决了
Func _pause()
        $hToolbar = ControlGetHandle("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:1]")
        If @error Then Return 0

        $iButCount = _GUICtrlToolbar_ButtonCount($hToolbar)

        If $iButCount = 0 Then 
                TrayTip("错误", "没有找到托盘程序,请手动暂停!",50)
                Return 0
        EndIf
        $hButton = ControlGetHandle("[Class:Shell_TrayWnd]", "", "Button2")
        If $hButton <> "" Then ControlClick("[Class:Shell_TrayWnd]", "", "Button2")
        For $i = 1 To $iButCount - 1
                $text = _GUICtrlToolbar_GetButtonText($hToolbar, $i)
                ;MsgBox(0,$i,$text)
                If String($text) = _Getname() Then ExitLoop
        Next


        $cID = _GUICtrlToolbar_IndexToCommand($hToolBar,$iButCount - $i - 1)
        _GUICtrlToolbar_ClickButton($hToolBar, $cID, "right", True)
EndFunc
发表于 2011-10-21 16:42:32 | 显示全部楼层
好贴 收藏了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-1 12:20 , Processed in 0.097481 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表