简体   繁体   English

有没有办法使用shell脚本在Mac OS X上获取当前活动的应用程序

[英]Is there a way to get current active app on Mac OS X using shell script

I want to run a CRON job which will identify currently active window and log it to some file. 我想运行一个CRON作业,它将识别当前活动的窗口并将其记录到某个文件中。 Is there a way through shell script to identify the currently active window on Mac? 有没有办法通过shell脚本来识别Mac上当前活动的窗口?

You may call applescript and do as explained in this other question. 您可以调用applescript并按照其他问题中的说明进行操作。

How to get name of frontmost app with AppleScript and use it to get the filepath 如何使用AppleScript获取最前面的应用程序的名称,并使用它来获取文件路径

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

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