Last active
September 28, 2024 22:00
-
-
Save samhenrigold/813e352babe2ab88a0be06a61405a028 to your computer and use it in GitHub Desktop.
Kill all Adobe CC daemons on app quit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Original script by Ted Wrigley (https://stackoverflow.com/questions/63786497/is-it-possible-to-run-an-automator-workflow-when-a-program-exits/69959340#69959340) | |
use framework "AppKit" | |
use scripting additions | |
property NSWorkspace : class "NSWorkspace" | |
property whitelist : {"com.adobe.ARM", "com.adobe.Acrobat", "com.adobe.Acrobat.Pro", "com.adobe.AdobePremierePro", "com.adobe.AfterEffects", "com.adobe.InCopy", "com.adobe.InDesign", "com.adobe.InDesignServer", "com.adobe.Lightroom2", "com.adobe.Lightroom3", "com.adobe.Muse.application", "com.adobe.Photoshop", "com.adobe.PhotoshopElements", "com.adobe.Reader", "com.adobe.bridge3", "com.adobe.bridge4", "com.adobe.bridge4.1", "com.adobe.dreamweaver-15.0", "com.adobe.dreamweaver-15.1", "com.adobe.dreamweaver-16.0", "com.adobe.dreamweaver-16.1", "com.adobe.estoolkit-3.0", "com.adobe.estoolkit-3.5", "com.adobe.estoolkit-3.6", "com.adobe.flash", "com.adobe.illustrator", "com.adobe.photodownloader", "com.adobe.pse11editor", "com.adobe.pse12editor", "com.adobe.pse9editor", "com.adobe.psexeditor"} | |
on run | |
set workSpace to NSWorkspace's sharedWorkspace() | |
set notificationCenter to workSpace's notificationCenter() | |
tell notificationCenter to addObserver:me selector:"someAppHasTerminated:" |name|:"NSWorkspaceDidTerminateApplicationNotification" object:(missing value) | |
end run | |
on idle | |
-- we don't use the idle loop, so tell the system let the app sleep. this comes out of idle once an hour | |
return 3600 | |
end idle | |
on someAppHasTerminated:notif | |
set termedApp to (notif's userInfo's valueForKey:"NSWorkspaceApplicationKey") | |
set termedAppID to (termedApp's bundleIdentifier) as text | |
if whitelist contains termedAppID then | |
do shell script "pkill -i -f adobe" | |
end if | |
end someAppHasTerminated: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment