Applescript get list of running apps?

前端 未结 8 1183
梦谈多话
梦谈多话 2020-12-30 05:47

Applescript newbie question again :) I am trying to create a small applescript that will allow me to select multiple items from a list of currently running applications and

8条回答
  •  春和景丽
    2020-12-30 06:14

    & (name of every process whose (name is "AppName") can be added to Michele Percich's and Parag Bafna's solutions to include specific menu bar applications by name.

    tell application processName to quit can be used instead of do shell script "Killall " & quoted form of processName.

    tell application "System Events"
        set processList to ¬
            (name of every process where background only is false) & ¬
            (name of every process whose ¬
                (name is "AppName") or ¬
                (name is "AnotherAppName"))
        tell me to set selectedProcesses to choose from list processList with prompt "Select process(es) to quit:" with multiple selections allowed
    end tell
    if the result is not false then
        repeat with processName in selectedProcesses
             tell application processName to quit
        end repeat
    end if
    

提交回复
热议问题