強制終了するApplescript
アプリを強制終了するApplescriptです。command + option + escで表示されないアプリだと固まったとき強制終了できないのでこの方法が有効です。
Mousqueakなんかはいつもこの方法で再起動しています。
kill_aProc("Mousqueak") of me
on kill_aProc(aProcName)
tell application "System Events"
set procList to every process whose name contains aProcName
if procList is not equal to {} then
set aProc to contents of first item of procList
tell aProc
set anID to unix id
end tell
do shell script "kill -9 " & (anID as string)
end if
end tell
end kill_aProc
end tell
赤字のアプリ名を変えて使用して下さい。
このスクリプト、どっかのサイトで学んだ内容だけど、どこか忘れた。
(追加:たしかココ)
2014/2/28