[zoom]関連プロセス強制終了
あくまでも参考にしてください
行番号 | ソース |
---|---|
001 | #! /usr/bin/env osascript |
002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
003 | #メニューバーの● ■ ▶︎ の右三角をクリックして実行してください↑ |
004 | # |
005 | # |
006 | # |
007 | # com.cocolog-nifty.quicktimer.icefloe |
008 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
009 | use AppleScript version "2.8" |
010 | use framework "Foundation" |
011 | use framework "UniformTypeIdentifiers" |
012 | use framework "AppKit" |
013 | use scripting additions |
014 | |
015 | property refMe : a reference to current application |
016 | |
017 | |
018 | set listBundleID to {"us.zoom.xos", "us.zoom.ZoomUninstaller", "us.zoom.ZMScreenshot", "us.zoom.CptHost", "us.zoom.caphost", "us.zoom.Transcode", "us.zoom.ZoomAutoUpdater", "us.zoom.zCCIMeetingHost", "us.zoom.ZoomClips"} as list |
019 | (* |
020 | repeat with itemBundleID in listBundleID |
021 | set strBundleID to itemBundleID as text |
022 | try |
023 | tell application id strBundleID to quit |
024 | end try |
025 | end repeat |
026 | *) |
027 | |
028 | repeat with itemBundleID in listBundleID |
029 | set strBundleID to itemBundleID as text |
030 | try |
031 | set ocidResultsArray to (refMe's NSRunningApplication's runningApplicationsWithBundleIdentifier:(strBundleID)) |
032 | set numCntArray to ocidResultsArray count |
033 | set ocidRunApp to (ocidResultsArray's objectAtIndex:0) |
034 | ###通常終了 |
035 | set boolDone to ocidRunApp's terminate() |
036 | ####強制終了 |
037 | set boolDone to ocidRunApp's forceTerminate() |
038 | end try |
039 | end repeat |
040 | |
041 | |
042 | set listAppName to {"zoom.us", "ZoomUninstaller", "ZMScreenshot", "CptHost", "caphost", "Transcode", "ZoomAutoUpdater", "zCCIMeetingHost", "ZoomClips"} as list |
043 | |
044 | |
045 | repeat with itemAppName in listAppName |
046 | set strAppName to itemAppName as text |
047 | set strCommandText to "/bin/ps -alxe | grep \"" & strAppName & "\" | grep -v \"grep\" | awk '{ print $2 }'" as text |
048 | set strResponce to (do shell script strCommandText) as text |
049 | log strResponce |
050 | set AppleScript's text item delimiters to "\r" |
051 | set listPID to every text item of strResponce |
052 | set AppleScript's text item delimiters to "" |
053 | |
054 | if (count of listPID) = 0 then |
055 | log "対象プロセス無し" |
056 | else |
057 | repeat with itemPID in listPID |
058 | ###プロセスを終了させる |
059 | doQuitApp2PID(itemPID) |
060 | end repeat |
061 | end if |
062 | end repeat |
063 | |
064 | |
065 | |
066 | ################################### |
067 | ########アプリケーションを終了させる |
068 | ################################### |
069 | to doQuitApp2PID(argPID) |
070 | set strPID to argPID as text |
071 | #### killallを使う場合 |
072 | set strCommandText to ("/bin/kill -15 " & strPID & "") as text |
073 | set ocidCommandText to refMe's NSString's stringWithString:strCommandText |
074 | set ocidTermTask to refMe's NSTask's alloc()'s init() |
075 | ocidTermTask's setLaunchPath:"/bin/zsh" |
076 | ocidTermTask's setArguments:({"-c", ocidCommandText}) |
077 | set listResults to ocidTermTask's launchAndReturnError:(reference) |
078 | log listResults |
079 | if item 1 of listResults is true then |
080 | log "正常終了" |
081 | else |
082 | try |
083 | set strCommandText to ("/bin/kill -9 " & strPID & "") as text |
084 | set strResponse to (do shell script strCommandText) as text |
085 | end try |
086 | end if |
087 | end doQuitApp2PID |
AppleScriptで生成しました |
| 固定リンク
「zoom」カテゴリの記事
- [zoom]zoomインストール(pkgutilで解凍する)(2024.08.28)
- [zoom]関連プロセス強制終了(2024.05.19)
- [zoom]キャッシュクリア(2023.12.19)
- [bash]Zoomアップデート 少し修正(2023.09.07)
- pkgインストール(ユーザー権限)(2023.07.04)