我有两个文本框和一个按钮。如何在文本框中输入值并Enter使用AutoIt按下按钮?
问问题
43883 次
3 回答
4
举个例子就这么简单:
$gui = GUICreate("Test GUI", 640, 280)
$input = GUICtrlCreateInput("Input field", 10, 10, 620, 20)
$edit = GUICtrlCreateEdit("Edit Control with Text", 10, 40, 620, 200)
$button = GUICtrlCreateButton("Button", 10, 250, 620, 20)
GUISetState(@SW_SHOW)
Sleep(2000)
ControlSetText("Test GUI", "", $input, "New text for the input")
ControlSetText("Test GUI", "", $edit, "New text for the edit... with some bla bla bla...")
Sleep(500)
ControlClick("Test GUI", "", $button)
Sleep(500)
ControlFocus("Test GUI", "", $input)
Sleep(4000)
ControlSetText("Test GUI", "", "[CLASS:Edit; INSTANCE:1]", "New text for the input, referenced as Edit1")
ControlSetText("Test GUI", "", "[CLASS:Edit; INSTANCE:2]", "New text for the edit..., referenced as Edit2 with some bla bla bla...")
Sleep(500)
ControlClick("Test GUI", "", "[CLASS:Button; INSTANCE:1]")
Sleep(500)
ControlFocus("Test GUI", "", $input)
Sleep(4000)
此外,你的英语很不清楚,你应该在你的问题上多加努力;-)
如果你想知道"[CLASS:Edit; INSTANCE:1]"
你必须使用什么,试试“AutoIt v3 Window Info”工具。并开始阅读一些非常好的文档。祝你好运!
于 2012-07-26T20:06:11.673 回答
3
您可以使用 ControlSend 功能如下:
ControlSend("窗口标题", "", "", "MyUsername{TAB}MyPassword{ENTER}")
也可以使用发送函数来完成:
发送("用户名")
发送("{TAB}")
发送("密码")
发送("{ENTER}")
于 2014-04-03T12:48:38.680 回答
-2
AutoItX x = new AutoItX();
x.controlSend("Login Station - Third party App","","","StringToBeEntered",false);
于 2018-03-13T06:53:44.560 回答