找回密码
 加入
搜索
查看: 5836|回复: 11

[系统综合] 请问,这种软件安装的选择子类界面,应该如何应对?

  [复制链接]
发表于 2013-1-9 11:18:36 | 显示全部楼层 |阅读模式
如图,来到这一步,韩,繁,简语言都是"x"不安装的的,我想把他们都选上,
而选上的操作要先点击左边“+”展开,但是我用工具箱都无法抓到这些button,无法做
ControlClick($title,"","[CLASS:Button; INSTANCE:5]")

然后又怎么样实现对这些"x"进行选择安装操作呢?   只能模拟右键吗?  有无方法可以直接注入指令让其选择上?

,请问高手们,有没有样板例子可以参考一下,怎么应对这种软件安装的操作界面?


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2013-1-9 11:19:58 | 显示全部楼层
如果用鼠标点击绝对位置,我觉得做起来应该会很麻烦,要计算偏移位,做起来就复杂了吧?
况且右边有上下拖拉条?
发表于 2013-1-9 11:54:00 | 显示全部楼层
回复 2# sanfer8889

有后台鼠标啊,看下UDF区~
发表于 2013-1-9 13:41:00 | 显示全部楼层
好东西 谢谢收藏一下
 楼主| 发表于 2013-1-9 16:02:39 | 显示全部楼层
本帖最后由 sanfer8889 于 2013-1-9 16:30 编辑

谢谢三楼大哥,
我借鉴了此贴的内容
http://www.autoitx.com/forum.php ... hlight=%BA%F3%CC%A8

做了个测试,提示moni.udf第七行 “函数call里面包含错误的参数”

#include "moni.udf"
Run("notepad.exe")
$hWnd = WinWaitActive("无标题 - 记事本")
$cWnd = ControlGetHandle($hWnd, "", "Edit1")
_SendString($cWnd, "PostMessage中文消息测试");发送中文字符测试


moni.udf内容是:
Func _SendString($hWnd, $Str)
        For $s = 1 To StringLen($Str)
                $St = StringMid($Str, $s, 1)
                If Asc($St) < 128 Then ;虚拟键码小于128为英文
                        _PostMessage($hWnd, 0x286, Asc($St), 0);WM_IME_CHAR
                Else;大于127为中文
                        $IME = StringToASCIIArray($St,0, 1, 1)
                        Local $ASCs = '0x'
                        For $a = 0 To UBound($IME) - 1
                                $ASCs &= Hex($IME[$a], 2);合并内码
                        Next
                        _PostMessage($hWnd, 0x286, $ASCs, 0);WM_IME_CHAR
                EndIf
        Next
        ;使用_SendMessageA也行
EndFunc   ;==>_SendString
 
Func _MouseClick($hWnd, $x, $y, $button = 'left', $times = 1, $delay = 250)
        Local $ix
        Local $lParam = BitOR(BitAND($x, 0xFFFF), $y * 0x10000)
        $button = StringLower($button)
        If $button = "left" Then
                For $ix = 1 To $times
                        _PostMessage($hWnd, 0x200, 0, $lParam);WM_MOUSEMOVE
                        _PostMessage($hWnd, 0x201, 1, $lParam);WM_LBUTTONDOWN
                        _PostMessage($hWnd, 0x202, 0, $lParam);WM_LBUTTONUP
                        If $ix < $times Then Sleep($delay)
                Next
        ElseIf $button = "right" Then
                For $ix = 1 To $times
                        _PostMessage($hWnd, 0x200, 0, $lParam);WM_MOUSEMOVE
                        _PostMessage($hWnd, 0x204, 2, $lParam);WM_RBUTTONDOWN
                        _PostMessage($hWnd, 0x205, 0, $lParam);WM_RBUTTONUP
                        If $ix < $times Then Sleep($delay)
                Next
        EndIf
EndFunc   ;==>_MouseClick
 
Func _SendKeys($hWnd, $iKeys,  $isBack = True)
        $iKeys = StringUpper($iKeys)
        If $hWnd <= 0 Or $iKeys = '' Then Return
        Local $ShiftDown = False, $CtrlDown = False, $AltDown = False, $CompKey = False
        
        If StringInStr($iKeys, '_') Then $CompKey = True ;'_'为组合键分隔符
        If $CompKey Then
                If StringInStr($iKeys, '{SHIFT}') Then
                        Send('{SHIFTDOWN}')
                        $ShiftDown = True
                EndIf
                If StringInStr($iKeys, '{CTRL}') Then
                        Send('{CTRLDOWN}')
                        $CtrlDown = True
                EndIf
                If StringInStr($iKeys, '{ALT}') Then
                        Send('{ALTDOWN}')
                        $AltDown = True
                EndIf
                $K = StringSplit($iKeys, '_', 1)
                If @error Then Return
                $iKeys = $K[$K[0]]
        EndIf
        If $isBack Then
                $iKeys = _IntVirtualKey($iKeys)
                $MapVK = _MapVirtualKey($iKeys, 0)
                $lParam = BitOR($MapVK * 0x10000, BitAND(1, 0xFFFF))
                _PostMessage($hWnd, 0x100, $iKeys, $lParam);WM_KEYDOWN
                _PostMessage($hWnd, 0x101, $iKeys, $lParam + 0xC0000000);WM_KEYUP
        Else
                $iKeys = StringLower($iKeys)
                ;Send('{ASC 0' & $iKeys & '}')
                Send($iKeys)
        EndIf
        If $AltDown Then Send('{ALTUP}');弹起alt
        If $CtrlDown Then Send('{CTRLUP}');弹起ctrl
        If $ShiftDown Then Send('{SHIFTUP}');弹起shift
EndFunc   ;==>_SendKeys
 
Func _MapVirtualKey($iCode, $iType)
        Local $Ret = DllCall('user32.dll', 'uint', 'MapVirtualKeyW', 'uint', $iCode, 'uint', $iType)
        If (@error) Or (Not $Ret[0]) Then Return ''
        Return $Ret[0]
EndFunc   ;==>_MapVirtualKey
 
Func _IntVirtualKey($iKey)
        If $iKey == '{BS}' Then Return 0x08
        If $iKey == '{TAB}' Then Return 0x09
        If $iKey == '{SHIFT}' Then Return 0x10
        If $iKey == '{CTRL}' Then Return 0x11
        If $iKey == '{ENTER}' Then Return 0x0D
        If $iKey == '{CLEAR}' Then Return 0x0C
        If $iKey == '{ALT}' Then Return 0x12
        If $iKey == '{PAUSE}' Then Return 0x13
        If $iKey == '{CAPS LOCK}' Then Return 0x14
        If $iKey == '{ESC}' Then Return 0x1B
        If $iKey == '{SPACEBAR}' Then Return 0x20
        If $iKey == '{PAGEUP}' Then Return 0x21
        If $iKey == '{PAGEDOWN}' Then Return 0x22
        If $iKey == '{END}' Then Return 0x23
        If $iKey == '{HOME}' Then Return 0x24
        If $iKey == '{LEFT}' Then Return 0x25
        If $iKey == '{UP}' Then Return 0x26
        If $iKey == '{RIGHT}' Then Return 0x27
        If $iKey == '{DOWN}' Then Return 0x28
        If $iKey == '{SELECT}' Then Return 0x29
        If $iKey == '{PRINT}' Then Return 0x2A
        If $iKey == '{EXECUTE}' Then Return 0x2B
        If $iKey == '{PRINTSCREEN}' Then Return 0x2C
        If $iKey == '{INS}' Then Return 0x2D
        If $iKey == '{DEL}' Then Return 0x2E
        If $iKey == '{F1}' Then Return 0x70
        If $iKey == '{F2}' Then Return 0x71
        If $iKey == '{F3}' Then Return 0x72
        If $iKey == '{F4}' Then Return 0x73
        If $iKey == '{F5}' Then Return 0x74
        If $iKey == '{F6}' Then Return 0x75
        If $iKey == '{F7}' Then Return 0x76
        If $iKey == '{F8}' Then Return 0x77
        If $iKey == '{F9}' Then Return 0x78
        If $iKey == '{F10}' Then Return 0x79
        If $iKey == '{F11}' Then Return 0x7A
        If $iKey == '{F12}' Then Return 0x7B
        If $iKey == '{F13}' Then Return 0x7C
        If $iKey == '{F14}' Then Return 0x7D
        If $iKey == '{F15}' Then Return 0x7E
        If $iKey == '{F16}' Then Return 0x7F
        If $iKey == '{NUM LOCK}' Then Return 0x90
        If $iKey == '{SCROLL LOCK}' Then Return 0x91
        If $iKey == '*' Then Return 0x6A
        If $iKey == '+' Then Return 0x6B
        If $iKey == '-' Then Return 0x6D ;BD
        If $iKey == '.' Then Return 0x6E
        If $iKey == '/' Then Return 0x6F
        If $iKey == ';' Then Return 0xBA
        If $iKey == '=' Then Return 0xBB
        If $iKey == ',' Then Return 0xBC
        If $iKey == '`' Then Return 0xC0
        If $iKey == '[' Then Return 0xDB
        If $iKey == '\' Then Return 0xDC
        If $iKey == ']' Then Return 0xDD
        Return Asc($iKey)
EndFunc   ;==>_MakeVirtualKey
 
Func _PostMessage($hWnd, $iMsg, $iwParam, $ilParam)
        DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hWnd, "uint", $iMsg, "wparam", $iwParam, "lparam", $ilParam)
EndFunc   ;==>_WinAPI_PostMessage
 楼主| 发表于 2013-1-9 16:33:11 | 显示全部楼层




这份UDF的代码实在看不懂,第七行报错,是因为什么原因呢?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2013-1-9 16:36:46 | 显示全部楼层
回复 5# sanfer8889

代码没有错误,要贴就上全部(包括错误信息,你这样说谁可以帮你解决),另外,插入代码时要加入代码标记或者高亮~
不会的就先看下论坛的置顶帖,你注册近三年了,不算新人了~~
 楼主| 发表于 2013-1-10 00:19:53 | 显示全部楼层
谢谢楼上大哥,我这把全部资料给展出,百思不得其解,我觉得我应该是UDF函数的使用方法是不是不对呢?

执行测试的
test.au3
#include "HouTai.udf"
Run("notepad.exe")
$hWnd = WinWaitActive("无标题 - 记事本")
$cWnd = ControlGetHandle($hWnd, "", "Edit1")
_SendString($cWnd, "PostMessage中文消息测试");
而moni.udf内容就是
http://www.autoitx.com/forum.php ... hlight=%BA%F3%CC%A8
所给的函数内容
也就是5楼的内容....

执行test.au3之后,就会提示六楼那张图片里的报错了。。。。


太感谢大大们的理解了。。。。。
 楼主| 发表于 2013-1-11 11:35:56 | 显示全部楼层
没能搞好这个报错;
换了路子,安装有个全部安装,这个容易选择,就折衷全部安装吧,总算把功能实现了。
太谢谢楼上的大哥们了。。。。。
发表于 2013-1-14 14:45:41 | 显示全部楼层
我帮楼主顶一下吧!!向你们学习!!!
发表于 2013-1-14 20:52:51 | 显示全部楼层
五楼大神 - - ~...............
发表于 2013-1-15 20:58:56 | 显示全部楼层
学习了,现在正在做一个,也有类似的问题
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-20 03:25 , Processed in 0.085344 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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