如何将文本写入外部应用程序
我正在开发一个应用程序来帮助用户更快地编写常见文本。
我想到的是一个 Windows 应用程序,用户可以在其中配置他的组合键,这样当他在 Outlook 或 Gmail 上编写电子邮件时,他只需按这些键,他之前配置的文本就会被粘贴进入他正在使用的任何应用程序。
因此,用户不必每次收到订单并想要发送确认电子邮件时都写“亲爱的先生,您的订单已成功收到”,他只需按“Crtl + O + R”之类的键即可,然后将为他写相应的文字。
我认为为了实现这一目标,我的应用程序必须做两件事:
- 当用户专注于不同的应用程序时,拦截用户按下的组合键。
- 将相应的文本“粘贴”到该应用程序。
我不知道如何实现这一点,因为我的应用程序要做的就是在另一个应用程序上“粘贴”文本(otlook、word、记事本或用户可以输入的任何内容),替换用户输入的短文本用他定义的长文本写的。
有什么建议吗?我研究过热键,但我不确定它们是否可行,而且我也不知道如何“粘贴”新文本。
谢谢。
I'm developing an application to help the user write common text faster.
What I have in mind is a Windows app where the user can configure his key combinations, so that when he's, for instance, writing an email on Outlook or Gmail, he just has to press those keys and the text he configured before will be pasted into whatever app he's using.
So, instead of a user having to write "Dear sir, your order has been received succesfully" every time he receives an order and wants to send a confirmation email, he could just press something like "Crtl + O + R", and the corresponding text will be written for him.
I think that in order to achieve that my app has to do two things:
- Intercept the key combination pressed buy the user when he's focused on a different app.
- "Paste" the corresponding text to that app.
I have no real clue on how to achieve this, because what my app will be doing is something like "pasting" text on another app (otlook, word, notepad or whatever thing a user can type into), replacing the short text the user wrote with the long text he defined.
Any suggestions? I've looked into hot keys, but I'm not sure they're the way to go, and I also have no idea on how to "paste" the new text.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否考虑过简单地将文本添加到剪贴板?在“复制到剪贴板”按钮旁边显示文本,用户只需抓住它并单击 Ctrl-V 即可。
想不出有哪个 Windows 应用程序可以这样做,但我知道这是可能的;哎呀,Bit.ly 可以通过您的浏览器完成此操作。
Have you considered simply adding text to the clipboard? Show the text next to a button that says "Copy to clipboard", and the user can just grab it and click Ctrl-V.
Can't think of a Windows app that does it this way, but I know it's possible; heck, Bit.ly can do it from your browser.