问题标签 [xdotool]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1365 浏览

bash - 按顺序运行 xdotool 脚本

我有这个脚本可以使 gnome 窗口无栏。它只是向上移动窗口,使条消失。问题是它有时不能按顺序工作,除非我在每个命令后添加 sleep 0.2 !有没有办法在上一个完成后强制运行下一个命令?

0 投票
1 回答
1684 浏览

linux - 在 bash 脚本中切换焦点

请帮助我了解我在尝试在 Linux 上的 Openbox 中使用热键组合调用的 Bash 脚本中使 Windows 失去焦点时遇到的一个小问题的根源。

我在脚本中有几行:

第一行遮蔽了有问题的窗口并将其“放在”所有其他窗口下方,但仍保持焦点。第二行理论上应该将焦点移动到堆栈中的下一个窗口......</p>

……确实如此!但仅当脚本与 gmrun 一起运行时,或在终端本身中运行(因为我试图隐藏和散焦的窗口是终端模拟器)。

但是,如果使用 Openbox hotlkey(这是我需要的)调用脚本,或者在 heignbour 终端中运行(仅用于测试),它不会按预期工作。

无论如何,我都不是一个熟练的 bash 用户。我通常可以在这里和那里拼凑一个简单的脚本以满足我的卑微需求,但在这里我只是迷路了。将不胜感激的建议。

0 投票
1 回答
208 浏览

linux - 检查 Linux BAT 中的重复应用程序

我正在尝试为 Linux 创建一个 .bat 文件:

  1. 检查应用程序的现有实例,然后
  2. 启动应用程序的初始实例或向前调用现有实例。

我目前有一个可以在一台 Linux 机器上运行的 .bat(如下),但它不能在其他机器上运行。

我的问题是,当我将此 .bat 复制到另一台机器时,它给了我错误:

默认搜索窗口名称、类和类名 XGetWindowProperty[_NET_WM_DESKTOP] 失败(代码=1)

我试过在第二台机器上手动输入一个新的 .bat ——仍然失败。

任何帮助是极大的赞赏。

0 投票
1 回答
508 浏览

c++ - xdotool cannot find Qt application window, where wmctrl can

I want to detect a Qt5 QWidgets application from its window title using xdotool to test the GUI under GNU/Windows with the latest Xubuntu LTS distro.

When I create any minimal Qt application, with wmctrl -l I can detect it, with xdotool it cannot be found, as shown here:

enter image description here

(note that searching for Enter s also fails)

Does anybody have a good experience with using xdotool on Qt QWidget applications, without using tricks like grepping through the wmctrl scripts?

AFAIKS, I am not the only one that has problems with this combination.

0 投票
1 回答
3348 浏览

linux - Xdotool 在 Raspberry Pi 上失败

我在我的 Raspberry Pi 上运行 Retropie,我想找到一种使用 GPIO 模拟击键的方法。Xdotool 似乎是我最好的选择,但它不能在本地或通过 ssh 工作。当我输入时,xdotool key 'd'我得到错误:
Error: Can't open display: (null) Failed creating new xdo instance
到目前为止,每个答案都声称要解决这个问题,我必须做一些变化,export DISPLAY=":0" xdotool key 'd'但这没有任何作用,它只是转到下一行。我对linux很陌生,所以提前谢谢。

0 投票
6 回答
4026 浏览

shell - Cron xdotool 不运行

我是使用 crontab 的新手,我一直在尝试做一个简单的 cron 工作。我想每 1 分钟按一次 F5 来刷新 Mozzila Firefox。我正在使用 xdotool 按 F5。我有脚本/usr/local/bin/refresh.sh:

如果我在命令行中运行它,它工作正常。和许可:

crontab我有:

但是由 cron 运行的脚本不起作用。谁能告诉我我做错了什么?

0 投票
2 回答
226 浏览

python - Python 自动按下 QtGUI 的按键

我有一个带有以下部分的python脚本:

我想要做的是运行可执行文件 ./test,它会打开一个 QtGUI。在这个 GUI 中,会出现一个按键提示按钮。我想自动化 GUI 的这个按键,以便可执行文件继续。

我的 python 脚本虽然运行了可执行文件,但出现了 GUI 提示,并且直到可执行文件之后才输入按键。有没有什么办法解决这一问题?

0 投票
1 回答
261 浏览

bash - encoding of period in text output

I am trying to output this xdotool type '172.06' into a textbox, but it enters 17206. Is there something wrong with the encoding? Why would it enter the period last? Note that when I run this in terminal it works perfectly.

I found a google group discussion about the topic, but didnt see an answer that applied to the . symbol

Notes:

  • xdotool version 3.20150503.1
  • layout: us
  • xdotool works in terminal (linux mint)
  • textbox is a text input field in the game EVE (not sure how to give more info about this)

  • 0 投票
    3 回答
    2698 浏览

    linux - 如何使用 xdotool 打开一个新选项卡,切换到它并在其中运行命令

    我正在尝试编写一个 bash 脚本来自动运行一些命令。但是,其中一些命令应该在它们自己的终端选项卡中运行。所以我在我的 bash 脚本中使用以下内容来打开一个新选项卡:

    这可以完成这项工作,但我的 bash 脚本中的下一个命令仍然在前一个终端选项卡中执行。如何使新打开的终端选项卡处于活动状态并运行此选项卡中的下一个命令?

    0 投票
    1 回答
    836 浏览

    python - 通过python粘贴到输入字段

    我很难找到合适的解决方案将我的输入粘贴到输入字段中。我正在使用库 Xdo。

    我在做什么 ?

    Python 文件在后端运行。

    该程序从智能卡中获取数据。

    返回的数据是数字/英语和泰语。

    然后在浏览器中,当我单击输入按钮时,值将被粘贴到输入按钮中。

    问题是什么?

    数字数据(身份证/生日)在浏览器中正确打印。

    泰国文本给了麻烦。它们有时没有插入或部分插入。

    *这曾经在 **windows机器上工作,但我使用的是不同的库(SendKeys for windows 程序)。但是在linux上使用 Xdo给我带来了麻烦。***

    以下是我的示例代码

    以下是示例图像。

    如您所见,一些泰语文本被部分输入,而另一些则被跳过。

    在此处输入图像描述

    非常感谢寻找任何建议或我当前解决方案的任何替代方案。