A Program to simulate keyboard presses

北慕城南 提交于 2019-12-10 16:38:12

问题


I am new to programming, I want to write a program (just for self-use) that will repeat a preset set of keyboard actions every time it is run, can anyone give me some advice? are there any applications that can do this already?


回答1:


There are a pretty good variety of programs out there that do what you're looking for. If you're on windows, autoHotKey will set you right. On Mac, it's automator (built-in) or Keyboard Maestro to the rescue.

These use a domain specific language for creating macros, which will be much simpler than attempting something yourself from scratch in a more general purpose language.




回答2:


You should use global keyboard hook.

There are .dll files that provide access to functions which enable you to send global keystrokes.

In Windows they are located in User32.dll but you can use wrappers if you're not familiar with hooking to DLL functions. For what language do you need this?




回答3:


What language do you program in? Java is a popular beginners language, you could read-up about the Robot class. It has functions that do "sendKeys"-type things.



来源:https://stackoverflow.com/questions/13551710/a-program-to-simulate-keyboard-presses

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