Applescript退出终端 [英] Applescript to quit Terminal

查看:407
本文介绍了Applescript退出终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我是Mac用户,他使用PostScript维护程序.附言由Adobe Distiller解释(蒸馏").所以有时候我想参加Adobe Distiller的第二或第三次会议.

Background: I’m a Mac user, who maintains a program in PostScript. Postscript is interpreted (‘distilled’) by Adobe Distiller. So sometimes I want a second or third session of Adobe Distiller.

要打开这样的实例,我有一个名为" DistillerNewInstance.command "的小文本文件:

To open such an instance I have a small text file named ‘DistillerNewInstance.command’:

open -n -a "Acrobat Distiller"
osascript -e 'tell application "Terminal" to close first window'
osascript -e 'tell application "Terminal" toquit saving no'

Distiller位完美工作.幸福.

The Distiller bit works perfectlly. Happiness.

但是Terminal不会退出.它询问您是否要在此窗口中终止正在运行的进程?".上面的某些变化会关闭窗口,但使终端保持运行状态.请在我的.command文件中放入哪些内容,这些内容将使Terminal安静地消失? (没有不安全地使用killall.)

But Terminal doesn’t quit. It asks "Do you want to terminate running processes in this window?". Some variations of the above close the window but leave Terminal running. Please, what can go in my .command file that will make Terminal quietly go away? (Without unsafe usage of killall.)

谢谢.

推荐答案

考虑执行 open 直接通过AppleScript使用其

Consider executing the open shell command directly via AppleScript using its do shell script command instead of via the Terminal application.

通过使用以下AppleScript,它将不需要关闭任何终端窗口并退出它.

By utilizing the following AppleScript it will negate the need to close any Terminal windows and quit it.

repeat 3 times
  do shell script "open -n -a" & space & quoted form of "Acrobat Distiller"
end repeat

上面给出的示例将启动 Acrobat Distiller 应用程序的三个实例.

The example given above will launch three instances of the Acrobat Distiller application.

这篇关于Applescript退出终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆