Applescript新手问题再次:)我试图创建一个小applescript,使我可以从当前运行的应用程序列表中选择多个项目,然后退出那些选定的应用程序。像这样的事情是可行的,但是与其不必单击每个对话框,倒不如从列表中选择。
tell application "System Events"
repeat with p in every process
if background only of p is false then
display dialog "Would you like to quit " & name of p & "?" as string
end if
end repeat
end tell
任何和所有帮助将不胜感激!
谢谢!
最佳答案
试试这个:
tell application "System Events"
set listOfProcesses to (name of every process where background only is false)
tell me to set selectedProcesses to choose from list listOfProcesses with multiple selections allowed
end tell
--The variable `selectedProcesses` will contain the list of selected items.
repeat with processName in selectedProcesses
do shell script "Killall " & quoted form of processName
end repeat
关于macos - Applescript获取正在运行的应用程序列表?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18372328/