找回密码
 加入
搜索
楼主: yufei8051

[AU3基础] (已解决)请教如何获得气泡提示窗口中的文字?

 火.. [复制链接]
发表于 2012-11-19 15:02:33 | 显示全部楼层
本帖最后由 afan 于 2012-11-19 16:32 编辑
请教超版
怎么把代码加到你9楼的代码里面呢?
加到哪一步分啊?
yufei8051 发表于 2012-11-19 14:59
#include <Date.au3>

HotKeySet('{esc}', '_Exit')

Local $o_speech, $Flag = 0, $hWnd, $sTitle, $sTxt, $sLast, $sAll
AdlibRegister('_GetWinTxt')

While 1
        If $Flag Then
                If $sAll <> $sLast Then
                        FileWrite(@ScriptDir & '\my.txt', '[' & _NowTime() & ']' & @CRLF & $sAll & @CRLF & @CRLF)
                        $sLast = $sAll
                EndIf
                $o_speech = ObjCreate('SAPI.SpVoice')
                $o_speech.Speak($sTitle & @CRLF & $sAll, 1)
        Else
                Sleep(1)
        EndIf
WEnd

Func _GetWinTxt()
        $hWnd = WinGetHandle('[CLASS:#32770]', '设置关注')
        If Not $hWnd Then
                $Flag = 0
                Return 0
        EndIf
        $sTitle = _GetWinTextFromPoint('[CLASS:#32770]', '设置关注', 13, 7)
        $sTxt = _GetWinTextFromPoint('[CLASS:#32770]', '设置关注', 13, 51)
        $sAll = $sTitle & @CRLF & $sTxt
        If $sAll == $sLast Then
                $Flag = 0
                Return 0
        EndIf
        $Flag = 1
EndFunc   ;==>_GetWinTxt

Func _Exit()
        Exit
EndFunc   ;==>_Exit

Func _GetWinTextFromPoint($title, $text, $_x, $_y)
        ;afan提示:获取窗口指定坐标点包含的窗口(控件)的文本
        Local $hWnd = WinGetHandle($title, $text)
        Local $tPoint = DllStructCreate('long X;long Y')
        DllStructSetData($tPoint, 1, $_x)
        DllStructSetData($tPoint, 2, $_y)
        DllCall('user32.dll', 'bool', 'ClientToScreen', 'hwnd', $hWnd, 'ptr', DllStructGetPtr($tPoint))
        Local $tPointCast = DllStructCreate('int64', DllStructGetPtr($tPoint))
        Local $aRt0 = DllCall('user32.dll', 'hwnd', 'WindowFromPoint', 'int64', DllStructGetData($tPointCast, 1))
        If @error Then Return SetError(2, '', '')
        Return ControlGetText($hWnd, '', $aRt0[0])
EndFunc   ;==>_GetWinTextFromPoint
更完善点的函数 _GetWinInfoFromPoint 在此 http://www.autoitx.com/thread-36184-1-1.html
 楼主| 发表于 2012-11-19 17:29:03 | 显示全部楼层
回复 46# afan


    感谢超版亲切关怀和具体指导,程序运行正常,预定目的完全实现!
    祝超版升官发财美女环绕长命百岁!
发表于 2012-11-19 19:55:33 | 显示全部楼层
小伙子不错嘛,都用上win8了。
 楼主| 发表于 2012-11-19 21:52:55 | 显示全部楼层
小伙子不错嘛,都用上win8了。
MicroBlue 发表于 2012-11-19 19:55



    紧跟科技潮流,哈哈
     win8的确好用,启动速度不到10秒,比win7快多了。
     而且基本上集成了所有常用软件,像虚拟光驱,压缩解压缩,杀毒,连浏览器我都直接使用ie10了,输入法用win8自带的拼音,省事多了
发表于 2012-11-20 18:44:29 | 显示全部楼层
又学习到了.
 楼主| 发表于 2015-1-19 09:32:04 | 显示全部楼层
原来两年前就问过这问题,我真是不长进
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 14:11 , Processed in 0.073476 second(s), 14 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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