我如何发送键码当前运行在其中下运行的葡萄酒Linux应用程序?我希望它是在bash为简单起见。

有帮助吗?

解决方案

使用包称为输入xvkbd 。这应该是每一个Linux发行版中。语法很简单:

xvkbd -text [line of keycodes]

例如运行魔兽3游戏自动Battle.net登录将是:

#!/bin/bash
cd ~/.wine/drive_c/Program\ Files/Warcraft3/
wine euroloader.exe -opengl > /dev/null 2> /dev/null & # run W3
sleep 5; # wait until animation fades out
xvkbd -text "b" # "b" is for Battle.net
sleep 7;
xvkbd -text "password\r" # password
sleep 3;
xvkbd -text "h" # "h" is for channel
sleep 5;
xvkbd -text "h" # honestly I don't know why, but without this the script might not work
sleep 5;
xvkbd -text "zcu\r" # type in your channel and join the room
sleep 5;
xvkbd -text ".load\r" # I'm using ghost, so I'll ask him what map is loaded
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top