Simulate User Input in 3rd Party Application

让人想犯罪 __ 提交于 2019-12-12 05:15:14

问题


Not sure where to start with this one ...

I'm thinking about creating a small little application to automate some repetitive text entry. I would like to be able to define snippets of text, and inject them into other applications when I want. What would be the best way to approach this problem? I have stumbled across UI Automation, as well as SendKeys. Any suggestions?

I don't mind if I have to "point out" the input controls for the application (like how Mac's native screenshot tool asks you to click on the window you want to capture). For instance, I could select the snippet of text in this application, then click on my other application's text input box, and that would somehow let the first application get a handle for the input's control to then simulate input.

Also, would there be any way to programmatically "submit" that form of controls once filled in? I come from a web design background, so a lot of this native application development is new to me.

Sorry if this is a vague question, I'm just not sure where to even start with this ...


回答1:


You could try AutoIt.




回答2:


I've successfully used the CBT "Computer Based Training" API functions in C++ for this to create self-running demos that inject windows messages, including mouse clicks, text, etc.

Here's a link that describes a macro record/playback that should get you started.

http://www.codeproject.com/KB/applications/winmacro.aspx

I think the old VB SendKeys function uses these CBT Journal Playback functions.



来源:https://stackoverflow.com/questions/5214474/simulate-user-input-in-3rd-party-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!