[英]Mac bash script - automate right arrow pressing every 2 minutes
Using Mac 10.11 version. 使用Mac 10.11版本。 Trying to write a bash script to automate "right arrow" press every two minutes. 尝试编写一个bash脚本,每两分钟自动执行“右箭头”。 Could someone help please? 有人可以帮忙吗?
Background: Have a deck. 背景:有一个甲板。 To move to the next page, every time i need to click right arrow. 要移动到下一页,每次我需要单击向右箭头。 So trying to eliminate "manually pressing of right arrow" every two minutes with the above script. 因此,尝试使用上述脚本每两分钟消除“手动按下右箭头”。
Already tried as suggested on Looking for a very simple Bash script for automated key press , but no luck. 已经尝试过寻找一个非常简单的Bash脚本自动按键 ,但没有运气。
Thank you! 谢谢!
Without knowing which application you are trying to automate, this should do what you are asking. 在不知道您尝试自动化哪个应用程序的情况下,这应该按照您的要求进行。
#!/bin/bash
osascript -e \
'tell application "System Events"
repeat
key code 124
delay 120
end repeat
end tell'
If you want to run this from Script Editor, remove osascript -e \\
and the single quotes at the beginning and the end of the script. 如果要从脚本编辑器运行此命令,请删除osascript -e \\
以及脚本开头和结尾的单引号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.