自动网页刷新使用xdotool - 没有窗口的焦点之后,发送键 [英] Automatic web-page refresh using xdotool - not sending key after window focus

查看:885
本文介绍了自动网页刷新使用xdotool - 没有窗口的焦点之后,发送键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑:

我的Firefox用的 [Firefox的网页标题] 的网页我的Ubuntu计算机上打开。

I have Firefox with the [Firefox Page Title] page open on my Ubuntu computer.

这是我的命令:

xdotool search "[Firefox Page Title]" windowactivate --sync key --clearmodifiers ctrl+r

文件:

xdotool网站,文档/例子是这里

xdotool website with documentation/examples is here.

为例直接从xdotool网站:

Example straight from the xdotool website:

# As of version 2.20100623, you can do this simpler version of above:
xdotool search "Mozilla Firefox" windowactivate --sync key --clearmodifiers ctrl+l

注:

我使用xdotool版本2.20110530.1。

I'm using xdotool version 2.20110530.1.

该命令正确聚焦我的屏幕到任何窗口的标题让我选择,但它不会发送CTRL + R键的窗口,该网站不会刷新。我收到的命令中没有错误消息。 (在Firefox刷新快捷键是Ctrl + R 的)

The command correctly focuses my screen to whatever window title I choose, but it doesn't send the ctrl+r key to the window, as the website doesn't refresh. I receive no error messages from the command. (Refresh shortcut in Firefox is ctrl+r)

通缉的行为:

该命令将希望(工作时)被应用到Web服务器统计页面这是我的服务器计算机上每天24小时开放,我想它会自动刷新页面,所以我可以看到新的交通到我的网站没有我不必做任何事情。

The command will hopefully (when it works) be applied to a web server statistics page that is open 24/7 on my server computer, I'd like it to refresh the page automatically so I can view new traffic to my website without me having to do anything.

编辑:我愿意使用可以提供此功能的其他应用程序,如果你知道的别的东西,很容易/类似的,请提供它作为一个答案!如果我不能得到这个工作,我会默认为下一个最好的事情。

I'm open to using other applications that can provide this functionality, if you know of something else that's easy/similar, please provide it as an answer! If I can't get this working I'll default to the next best thing.

推荐答案

尝试几种不同的方法来获得xdotool正常工作后,我倾向于认为,xdotool本身就是问题即可。以下是我试过,但没有奏效。

After trying several different approaches to get xdotool to work correctly, I'm inclined to believe that xdotool itself is the issue. Here is what I tried, none worked.


  • 运行命令(和变化 - 删除/添加参数)。从终端

  • 运行命令(和变化 - 删除/添加参数)。从SH脚本

  • F5和Ctrl + R键之间的转换,因为它们既要刷新一个Firefox网页。

  • 尝试其他的参数,如:

    • - 窗口设置窗口的键是要发送到

    • - 延迟添加延迟发送键之前,被聚焦到窗口之后

    • 添加键之前睡眠发送,窗口集中后。

    我亦在脚本尝试这些命令,作为用于xdotool的头版建议,尽管它指出这是旧版本的,因为它被分离成多个命令。 新版本是我试图之前执行的版本,是一个简单的命令(见问题)。

    I also tried these commands in a script, as the frontpage for xdotool recommends, although it states this is the "older" version, as it is separated into multiple commands. The "new" version was the version I was trying to execute before and is a single command (see question).

    WID=`xdotool search "Firefox Page Title"`
    xdotool windowactivate --sync $WID
    xdotool key --clearmodifiers ctrl+r
    

    以上所有的尝试总是正确地聚焦到我想要的窗口,但它不会发送键无论是F5或Ctrl + R的。

    但是,下面的工作正常:

    xdotool selectwindow key ctrl+r
    

    xdotool selectwindow key F5
    

    selectwindow 命令,执行的时候,把你的光标变成一个矩形选区工具,在这一点上,你可以选择你要集中,在这种情况下,窗口,什么窗口,无论是按Ctrl + R或F5键发送。不幸的是,这不是我一直在寻找的,因为它需要用户输入才能正常工作。

    The selectwindow command, when executed, turns your cursor into a rectangular selection tool at which point you can select the window you want to be focused and, in this case, what window to send either the ctrl+r or F5 key to. Unfortunately, this is not what I was looking for, as it requires user input to work correctly.

    最终解决方案:

    我的解决方案(因为我试图用xdotool不断刷新网页)是使用的 ReloadEvery 的Firefox插件,这刷新你把它放在任何你选择的时间间隔的任何页面。它的目的是歌剧浏览器的内置自动刷新页面功能的翻版,而迄今为止,这效果很好。

    My solution (since I was attempting to use xdotool to constantly refresh a web-page) was to use the ReloadEvery Firefox add-on, which refreshes any page you set it on in any time interval you choose. It is intended to be a replica of the Opera browser's built-in automatic page refresh feature, and thus far, it works well.

    对于那些你谁使用Chrome和正在寻找类似的解决方案,有很多的插件可供你。 https://chrome.google.com/webstore/search/auto%20refresh

    For those of you who use Chrome and are looking for a similar solution, there are plenty of add-ons available for you too. https://chrome.google.com/webstore/search/auto%20refresh

    这篇关于自动网页刷新使用xdotool - 没有窗口的焦点之后,发送键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆