ControlSetText
设置控件文本.
ControlSetText ( "title", "text", controlID, "new text" [, flag = 0] )
参数
title
|
目标窗口标题, 或句柄, 或类名. 参考窗口标题与文本(高级).
|
text
|
目标窗口文本. 参见 窗口标题与文本
|
controlID
|
控件标识符. 相关说明见 控件.
|
new text
|
更新到控件的新文本.
|
flag
|
[可选] 设置为非 0 时 (默认), 将刷新目标窗口.
|
返回值
成功:
|
返回 1.
|
失败:
|
返回 0, 未找到窗口/控件.
|
函数示例
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Run Notepad
Run("notepad.exe")
; Wait 10 seconds for the Notepad window to appear.
Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
; Set the edit control in Notepad with some text. The handle returned by WinWait is used for the "title" parameter of ControlSetText.
ControlSetText($hWnd, "", "Edit1", "This is some text")
; Retrieve the text of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetText.
Local $sText = ControlGetText($hWnd, "", "Edit1")
; Display the text of the edit control.
MsgBox($MB_SYSTEMMODAL, "", "The text in Edit1 is: " & $sText)
; Close the Notepad window using the handle returned by WinWait.
WinClose($hWnd)
EndFunc ;==>Example
----------------------------------------
该函数可以通过命令 exect 调用
参见:
ControlGetText, ControlCommand, ControlSend, SplashTextOn
exect=ControlSetText('[CLASS:Notepad]','''','Edit1','Новый~~текст~~уставленный~~в~~элемент~~Edit') ;;用记事本中指定的文本替换文本(应该启动)
start=%%COMMANDER_PATH%%\PK\PK.exe exect=$var_h=WinWaitActive('[CLASS:ThunderRT6FormDC]')||ControlSetText(Eval('var_h'),'''','ThunderRT6TextBox1','пароль') ;; 启动程序,等待窗口打开,并在指定的字段中输入文本"密码"
start=%%COMMANDER_PATH%%\PK\PK.exe exect=$var_h=WinWaitActive('[CLASS:ThunderRT6FormDC]')||ControlSetText(Eval('var_h'),'''','ThunderRT6TextBox1','пароль')||ControlClick(Eval('var_h'),'''','ThunderRT6CommandButton3') ;; 启动程序,等待窗口打开,并在指定的字段中输入文本"密码",然后单击确定按钮
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|