如何隐藏 Windows 程序并发送点击和填写表格?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2307593/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to hide windows program and send clicks and fill out forms?
提问by bkbkbk
i need to hide a windows program (not visible in taskbar, system tray. visible in taskmgr). and send clicks and fill out forms on this windows program (while hidden).
我需要隐藏一个 Windows 程序(在任务栏、系统托盘中不可见。在 taskmgr 中可见)。并发送点击并填写此 Windows 程序上的表格(隐藏时)。
possible with autoit or autohotkey ? any other suggestions ?
可以使用 autoit 或 autohotkey 吗?还有其他建议吗?
采纳答案by MadBoy
To hide application you need to use (AutoIt v3):
要隐藏您需要使用的应用程序 (AutoIt v3):
WinSetState($application_name, "", @SW_HIDE)
WinSetState($application_name, "", @SW_SHOW)
Where $application_name is your application name. First one is to hide, 2nd one is to show.
其中 $application_name 是您的应用程序名称。第一个是隐藏,第二个是显示。
I am not sure if you can fill out forms when it's hidden thou but i guess you could verify it yourself. Probably you would have to use ControlSend
to directly send text to control.
我不确定您是否可以在隐藏表格时填写表格,但我想您可以自己验证。可能您必须使用ControlSend
直接发送文本到控件。
回答by MemphiZ
You can hide windows like MadBoy showed and then fill/adjust controls using the "ControlCommand"-Function of AutoIt like this:
您可以像 MadBoy 显示的那样隐藏窗口,然后使用 AutoIt 的“ControlCommand”-Function 填充/调整控件,如下所示:
WinSetState("Screen Resolution", "", @SW_HIDE)
ControlCommand("Screen Resolution", "", "ComboBox1", "SetCurrentSelection", "2")
WinSetState("Screen Resolution", "", @SW_SHOW)
To detect which Classname a control has you must use the AutoIt Window Info tool which comes with AutoIt and is installed by default.
要检测控件具有哪个类名,您必须使用 AutoIt 随附并默认安装的 AutoIt Window Info 工具。
To fill out TextBoxes for example you would use:
例如,要填写 TextBoxes,您将使用:
ControlCommand("WinTitleHere", "", "Edit1", "EditPaste", "This is some text")
This even works with hidden windows.
这甚至适用于隐藏的窗口。