应用程序正常关闭
我想创建一个 Mac Leopard 应用程序,该应用程序将监视在同一台计算机上运行的另一个应用程序,并在受监视的应用程序运行 x 小时后“优雅地”关闭该应用程序。您建议我使用什么语言来创建监控应用程序?
I want to create a Mac Leopard application that will monitor another application, running on the same computer, and "gracefully" shutdown the monitored application after it has been running for x number of hours. What language would you suggest I use to create the monitoring application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于这是一个一般性问题,我只给出一个一般性答案:
如果可以从命令行启动受监视的应用程序,那么任何高级语言(Python、Ruby 等)都将能够启动应用程序并启动计时器。
关闭应用程序取决于您所说的“优雅地”是什么意思。如果您只想停止应用程序,可以发出
kill
命令,但能否“优雅地”关闭它取决于应用程序暴露自身的程度。您可以使用 Applescript 或其他脚本语言来要求它正常关闭吗?Since this is a general question I'll just give a general answer:
If the monitored application can be started from the command line than any of the high level languages (Python, Ruby, etc) will be able to start the application and start a timer.
Shutting down the application depends on what you mean by "gracefully". If you just want to stop the application, you can issue a
kill
command, but to be able to shut it down "gracefully" depends on how much the application exposes itself. Can you use Applescript, or other scripting languages to ask it to shut down gracefully?