本帖最后由 w60711 于 2019-12-1 00:58 编辑
请问各位前辈
目前有一个外部窗口
有 Edit1,Edit2 控件,Edit1裡头有文字
现在想要在不激活该窗口的状况下
将Edit1裡面的文字清除再输入新的
但一直不顺利
想请教是否有啥方法,感谢~
(不清除的话会接续着写入...)
以下2种方法试过无效...$win = "[CLASS:LauncherDialog]"
$hWin = WinGetHandle($win)
$btnCtrl1 = "[CLASS:Edit; INSTANCE:1]"
$CtrlHandleEdit1 = ControlGetHandle($win,"", $btnCtrl1)
ControlFocus($hWin, '', $btnCtrl1)
Sleep(1000)
ControlSend($hWin, '', $btnCtrl1, '^a')
Sleep(250)
_SendText(String($CtrlHandleEdit1), '新文字') ;;Edit1
$win = "[CLASS:LauncherDialog]"
$hWin = WinGetHandle($win)
$btnCtrl1 = "[CLASS:Edit; INSTANCE:1]"
$btnCtrl1 = "[CLASS:Edit; INSTANCE:2]"
$CtrlHandleEdit1 = ControlGetHandle($win,"", $btnCtrl1)
ControlFocus($hWin, '', $btnCtrl2)
Sleep(1000)
_SendKeys($hWin, '{TAB}')
Sleep(250)
_SendText(String($CtrlHandleEdit1), '新文字') ;;Edit1
|