[英]Using xte in linux script
I have a question about xte and how it works in a linux ubuntu script. 我有一个关于xte以及它如何在linux ubuntu脚本中工作的问题。
My script opens a program (./program_to_open) and a file concurrently (~path/to/file.txt). 我的脚本同时打开一个程序(./program_to_open)和一个文件(~path / to / file.txt)。 The line is: 这条线是:
./program_to_open ~/path/to/file.txt
I would like to use the keyboard command "Control+S" to save this file. 我想使用键盘命令“Control + S”来保存此文件。 If I understand xte correctly, and I probably don't, I'd use a script like this: 如果我正确理解了xte,而我可能没有,我会使用这样的脚本:
#!/bin/bash
cd Desktop/user/folder...
./file_to_open ~/path/to/file.txt
sleep 3
xte 'key Control_S'
...or... ...要么...
#!/bin/bash
cd Desktop/user/folder...
./file_to_open ~/path/to/file.txt
sleep 3
xte 'keydown Control_S'
sleep 1
xte 'keyup Control_S'
Is this the way it's supposed to work or am I overlooking something? 这是它应该工作的方式还是我忽略了什么?
It seems that the only way to hold down multiple keys at the same with xte
is using several keydown
commands. 似乎用xte
同时按住多个键的唯一方法是使用几个keydown
命令。 The following worked for me: 以下对我有用:
xte 'sleep 3' 'keydown Control_L' 'keydown s' 'keyup Control_L' 'keyup s'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.