linux模拟键盘按键

Automatic keyboard pressers are useful tools. However, it seems that there is no simple and easy to use automatic keyboard presser for Linux if you search for “automatic keyboard presser linux”. After some digging, I find using the xvkbd with some options is a good method for automatic keyboard pressing though it is not designed for this purpose.

自动键盘按下器是有用的工具 。 但是,如果您搜索“ Linux的自动键盘按键”,似乎没有简单易用的Linux自动键盘按键。 经过一番挖掘后,我发现使用xvkbd和一些选项是自动按键盘的好方法,尽管它不是为此目的而设计的。

一个例子∞ (One example ∞)

Let’s use one example here to introduce how to use xvkbd as a automatic keyboard presser: we want to refresh the browser every 5 seconds to check a webpage for changes. If you do it manually, you press Ctrl + r every 5 seconds. Let’s make the computer do it automatically for us while what we need to do is just to watch the screen while drinking a cup of tea.

让我们在这里使用一个示例来介绍如何将xvkbd用作自动键盘xvkbd器:我们希望每5秒刷新一次浏览器以检查网页是否有变化。 如果您手动执行此操作,则每5秒按Ctrl + r 。 让我们让计算机为我们自动完成它,而我们需要做的就是只是在喝杯茶的同时观看屏幕。

xvkbd发送一个字符串∞ (xvkbd sends a string ∞)

xvkbd has an option -text which can send the string to the focused window:

xvkbd有一个选项-text它可以将字符串发送到焦点窗口:


-text string
Send the string to the focused window (see also `-window' option).
If this option is specified, xvkbd will not open its window and terminate soon after sending the string.
The string can contain:\r - Return
\t - Tab
\b - Backspace
\e - Escape
\d - Delete
\S - Shift (modify the next character; please note that modify with ``\S'' will be ignored in many cases. For example, ``a\Cb\ScD\CE'' will be interpreted as a, Control-b, c, Shift-D, and Control-Shift-E.)
\C - Control (modify the next character)
\A - Alt (modify the next character)
\M - Meta (modify the next character)
\[keysym] - the keysym keysym (e.g., \[Left]), which will be processed in the similar matter with other general characters
\{keysym} - the keysym keysym (e.g., \{Left}), which will be processed in more primitive matter and can also be used for modofier keys such as Control_L, Meta_L, etc.; also, \{+keysym} and \{+keysym} will simulate press and release of the key, respectively
\Ddigit - delay digit * 100 ms
\xvalue - move mouse pointer (use "+" or "-" for relative motion)
\yvalue - move mouse pointer (use "+" or "-" for relative motion)
\mdigit - simulate click of the specified mouse button

With this option, we can send out Ctrl + r by:

使用此选项,我们可以通过以下方式发送Ctrl + r

xvkbd -text "\Cr"

脚本为自动按键∞ (The script as the automatic key presser ∞)

With the option of xvkbd, we can write our own automatic key presser with a bit bash script to repeatedly invoke xvkbd.

使用xvkbd选项,我们可以使用一些bash脚本编写自己的自动按键,以重复调用xvkbd

Here comes the script that automatically refresh the browser (the active window).

这是自动刷新浏览器(活动窗口)的脚本。


while true; do xvkbd -text "\Cr"; sleep 5; done;

Execute it in a shell, make the browser focused and then you can watch the page “automatically” refreshed.

在shell中执行它,使浏览器聚焦,然后您可以观看“自动”刷新的页面。

When you want to stop the “automatic keyboard presser”, just press Ctrl+c in the shell window.

当您要停止“自动键盘按下器”时,只需在外壳程序窗口中按Ctrl+c

More interesting and complex key pressers can be made using the functions provided by xvkbd (especially the \D to delay a little while).

可以使用xvkbd提供的功能(尤其是\D稍有延迟)来制作更有趣,更复杂的按键。

翻译自: https://www.systutorials.com/automatic-keyboard-presser-on-linux/

linux模拟键盘按键

linux模拟键盘按键_Linux上的自动键盘按键相关推荐

  1. android手游自动按键,天涯明月刀手游自动弹奏按键精灵使用详细教学 安卓ios使用教程...

    天涯明月刀手游自动弹奏案件精灵代码怎么编写和使用?天涯明月刀手游ios怎么自动弹奏?一起来看看吧. 天涯明月刀手游自动弹奏按键精灵使用详细教学 一.前言 由于游戏内触屏不精准,音符时长难以控制,多音/ ...

  2. 计算机键盘特点,市面上的笔记本键盘优缺点解析,看完秒懂!

    大家在选购电脑时,很多人的关注重点都是笔记本的配置好不好.外观设计酷不酷和电池续航能力强不强,对电脑键盘往往不会太在意,其实一个好的电脑键盘也可以帮助你提高工作效率,特别对于小编这样的文字工作者,如果 ...

  3. 滴普技术荟-云原生基座OpenKube开放容器实践(四):linux模拟pod并配置上外网

    前言 这篇文章我们将完成以下几件事情: 用docker模拟一个POD 将这个POD和主机连接起来,在主机中能访问POD的网站 让这个POD能上外网 模拟一个POD POD是一个K8S的逻辑概念,POD ...

  4. linux登陆界面卡死_Linux 上最好的五款音乐播放器

    Jack Wallen 盘点他最爱的五款 Linux 音乐播放器. 不管你做什么,你都有时会来一点背景音乐.不管你是开发.运维或是一个典型的电脑用户,享受美妙的音乐都可能是你在电脑上最想做的事情之一. ...

  5. linux删除mysql临时文件_linux下mysql自动备份数据库与自动删除临时文件_MySQL

    bitsCN.com linux下mysql自动备份数据库与自动删除临时文件 一.每日23:00自动删除临时文件 首先查看一下crontab的任务列表:crontab -l然后新建:crontab - ...

  6. 关于89 jb2上的自动设置按键唤醒系统的功能以及L版本上设置唤醒键

    [Description] 目前89 jb2版本上是默认实现打电话状态下实现按键唤醒系统的功能的,这样可以满足电话过程中的音量键有效等需求, 但是这套机制同时限制了一般状态下的按键唤醒系统的实现,因此 ...

  7. linux mysql temp 设置_linux上mysql的简单入门

    默认状态下其它pc是不能通过ip访问,本地mysql的,需要修改一个配置,如下 $ sudo vi /etc/mysql/my.cnf 找到行 bind-address = 127.0.0.1 直接注 ...

  8. linux php项目启动_Linux上实现Node.js项目自启动

    用node express写项目的时候,想让Node项目后台执行,虽然安装了forever包,但是每次server重新启动,都要管理员手动的去执行下才可以,所以还是挺不方便的. 注:centos 7. ...

  9. linux模拟键盘按键方案(收藏)

    linux模拟键盘按键方案(收藏) 在这以前,我一直以为,除非搞X Window级别的开发,否则根本没法在Linux下模拟键盘消息,或者说键盘事件.像QT,GTK这些High Level的GUI li ...

  10. QT接收Linux内核,嵌入式linux上QT标准键盘输入的实现

    在嵌入式平台上运行QTE时,使用的键盘通常不是标准键盘,而是嵌入式设备外扩的普通按键.那么实现QTE键盘输入的方法大体上可以分为两类: (1)编写一个普通按键驱动,然后开辟一个QT线程读取按键值,在通 ...

最新文章

  1. 经理让我复盘上次Redis缓存雪崩事故
  2. 异常检测——局部异常因子(Local Outlier Factor ,LOF)算法
  3. 大数据与测试测量的结合
  4. D2 AJAX 封装策略
  5. 【福利】思科/华为/华三模拟器软件分享,附下载链接
  6. java父类shape_java父类为抽象类,子类构造方法传参
  7. (49)Xilinx Subtracter IP核配置(十)(第10天)
  8. geojson 河流_GeoJSON 数据类型 | JShare
  9. 基于matlab和lingo的数学实验,MATLAB和LINGO软件在数学建模竞赛中的应用-精选教育文档...
  10. 【航模】凤凰模拟器安装
  11. spark sample采样
  12. NMODBUS4.0源码下载地址
  13. Least Angel Regression
  14. 网易云信周梁伟专访:亿级架构IM平台的技术难点解析
  15. JS 图片放大缩小、旋转
  16. 11年北漂老码农转行!黯然离场...
  17. 北漂程序员一天的生活
  18. svn: E155037: Previous operation has not finished; run 'cleanup' if it was i
  19. 毕业设计-基于spring boot的智慧物业管理系统
  20. Memory Fusion Network for Multi-view Sequential Learning注意力融合MFN

热门文章

  1. 对不起,免费午餐现在只提供稀饭了-- MSN停止支持对第三方软件的登录请求
  2. 哈工大计算机系统大作业——程序人生
  3. meterpreter下抓取windows系统明文密码实验
  4. verilog 产生m序列
  5. 【python】六一新玩法turtle画哆啦A梦
  6. Moviebooking电影售票系统--用例建模
  7. lamp兄弟连 mysql_lamp兄弟连视频笔记
  8. 差分管电路图_电子管差分放大电路改造方案
  9. 网络安全技能大赛D模块常规漏洞加固详解
  10. 复化科特斯公式matlab_基于牛顿—科特斯积分的误差分析