Linux 中 applescript 的替代品有哪些?它们有何不同?
我正准备切换到Linux。我想更多地了解 Linux 用户如何解决 OSX 用户使用 Applescript 解决的问题。更具体地说:它们叫什么?它们有何不同?
I'm preparing to switch to Linux. I want to learn more about what Linux users do to solve problems that OSX users solve with Applescript. More specifically: What are they called? How are they different?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
许多 Linux 应用程序通过命令行提供基本的 UI 交互。
对于那些不完全按照您想要的方式进行操作的人,您可以尝试一些 UI 自动化工具,例如:
Many Linux applications provide basic UI interactions from the command-line.
For those that don't do quite what you'd like you might try some UI automation tools such as:
我假设您正在使用 applescript 来实现基本的系统自动化。可用的语言有很多种,但没有一种语言像 OS X 上的 applescript 那样与窗口环境/应用程序紧密/统一地集成。您可能会发现某些应用程序具有可用于某种语言的脚本环境。一般来说,对于基本自动化,您可以使用您选择的任何 shell 脚本语言(bash、tcsh 等)。由于这些相同的语言也可以在 OS X 上使用,因此您可以首先尝试在该环境中使用它们。请务必查看您希望自动化的各种程序的手册页,以找出需要使用哪些命令行参数来获得您想要的行为。
I am assuming you're using applescript for basic system automation. There are a wide variety of languages available, but none as closely/uniformly integrated with the windowing environment/applications as applescript on OS X. You might find certain applications have scripting environments available for a certain language. In general, for basic automation, you'd do fine with any shell scripting language of your choice (bash, tcsh, ...). Since those same languages are also available on OS X, you might try working with them in that environment first. Be sure to check out the manual pages for the various programs you wish to automate, to find out what command-line parameters you need to use to get the behavior you want.
xdotool
正如之前的评论者所写,我不确定您要做什么。但对于我试图解决的问题(1.移动鼠标2.自动化按键),我找到了xdotool 此处。
那里涵盖了大部分细节,但以下是如何开始(全部从其他站点复制):
在 Linux 上安装 Xdotool
对于 Ubuntu、Debian 或 Linux Mint,您可以这样做:
对于 Fedora,使用 yum 命令:
对于 < strong>CentOS 用户,该软件包可在 EPEL 存储库中找到。启用 EPEL repo 后,只需使用上面的 yum 命令即可。
对于 Arch 用户,该软件包可在社区存储库中找到:
如果您找不到适合您的发行版的 xdotool,您可以随时从 官方网站。
xdotool
As the previous commenters wrote, I'm not sure what you're trying to do. But for the problems I was trying to solve (1. moving the mouse 2. automating keypresses), I found xdotool here.
Most of the details are covered there, but here's how to get started (all copied from the other site):
Installation of Xdotool on Linux
For Ubuntu, Debian or Linux Mint, you can just do:
For Fedora, use yum command:
For CentOS user, the package is available in EPEL repo. After enabling EPEL repo, simply use yum command as above.
For Arch user, the package is available in the Community repo:
If you cannot find xdotool for your distribution, you can always download it from the official website.