问题
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.
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'
The Distiller bit works perfectlly. Happiness.
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.)
Thank you.
回答1:
Consider executing the open shell command directly via AppleScript using its do shell script command instead of via the Terminal application.
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
The example given above will launch three instances of the Acrobat Distiller application.
来源:https://stackoverflow.com/questions/58578550/applescript-to-quit-terminal