Last active
June 3, 2022 16:16
-
-
Save TaylorJadin/4cdfb5ced273c52e7434e54f160bf2c9 to your computer and use it in GitHub Desktop.
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
set appName to "Stream Deck" | |
set usbDeviceName to "Stream Deck" | |
set usbData to do shell script "system_profiler SPUSBDataType -detailLevel basic" | |
if usbData contains usbDeviceName then | |
log "Stream Deck connected" | |
if application appName is running then | |
log "Stream Deck.app is already running" | |
else | |
log "Launching Stream Deck.app" | |
do shell script "open -a '/Applications/Stream Deck.app/Contents/MacOS/Stream Deck' --args --runinbk" | |
end if | |
else | |
log "Stream Deck disconnected, quitting Stream Deck.app" | |
try | |
tell application appName to quit | |
on error error_message number error_number | |
if error_number is not -128 then | |
display dialog "Error: " & the error_number & ": " & the error_message buttons {"OK"} default button 1 | |
end if | |
end try | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment