Help us understand the problem. What is going on with this article?


More than 3 years have passed since last update.
  • 反応しなくなったアプリケーションを強制的に閉じるときに使える
  • background onlyのアプリケーションも対象にできる
use scripting additions
use framework "AppKit"

my forceQuitApplication("SystemUIServer")

on forceQuitApplication(anApplication)
    --require Framework: AppKit
    tell application "System Events"
        set bundleIdentifier to bundle identifier of my getProcess(anApplication)
    end tell
    return (current application's NSRunningApplication's runningApplicationsWithBundleIdentifier:bundleIdentifier)'s forceTerminate as boolean
end forceQuitApplication

on getProcess(args)
    tell application "System Events"
        if class of args = application then
            return application process (name of args)
        else if class of args = application process then
            return args
            return application process (args as text)
        end if
    end tell
end getProcess


  • 2016-01-31: AppKitフレームワークのNSRunningApplicationクラスを使って作成
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away