简体   繁体   English

Linux中的applescript有哪些替代方案? 他们有什么不同?

[英]What are the alternative(s) to applescript in Linux? How are they different?

I'm preparing to switch to Linux. 我准备切换到Linux。 I want to learn more about what Linux users do to solve problems that OSX users solve with Applescript. 我想更多地了解Linux用户如何解决OSX用户使用Applescript解决的问题。 More specifically: What are they called? 更具体地说:他们叫什么? How are they different? 他们有什么不同?

Many Linux applications provide basic UI interactions from the command-line. 许多Linux应用程序从命令行提供基本的UI交互。

For those that don't do quite what you'd like you might try some UI automation tools such as: 对于那些没有做到你想要的人你可能会尝试一些UI自动化工具,例如:

I am assuming you're using applescript for basic system automation. 我假设你正在使用applescript进行基本的系统自动化。 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. 有多种语言可供选择,但没有一种语言与OS X上的applescript紧密/统一地集成在窗口环境/应用程序中。您可能会发现某些应用程序具有可用于某种语言的脚本环境。 In general, for basic automation, you'd do fine with any shell scripting language of your choice (bash, tcsh, ...). 通常,对于基本自动化,您可以使用您选择的任何shell脚本语言(bash,tcsh,...)。 Since those same languages are also available on OS X, you might try working with them in that environment first. 由于OS X上也提供了相同的语言,因此您可以先尝试在该环境中使用它们。 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 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 . 但是对于我试图解决的问题(1.移动鼠标2.自动按键),我在这里找到了xdotool 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 在Linux上安装Xdotool

For Ubuntu, Debian or Linux Mint, you can just do: 对于Ubuntu,Debian或Linux Mint,您可以这样做:

sudo apt-get install xdotool

For Fedora, use yum command: 对于Fedora,使用yum命令:

sudo yum install xdotool

For CentOS user , the package is available in EPEL repo. 对于CentOS用户 ,该软件包可在EPEL repo中获得。 After enabling EPEL repo, simply use yum command as above. 启用EPEL repo后,只需使用上面的yum命令。

For Arch user, the package is available in the Community repo: 对于Arch用户,该程序包在社区存储库中可用:

sudo pacman -S xdotool

If you cannot find xdotool for your distribution, you can always download it from the official website . 如果找不到xdotool供您分发,可以随时从官方网站下载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM