Skip to content

Instantly share code, notes, and snippets.

@TaylorJadin
Last active June 3, 2022 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TaylorJadin/4cdfb5ced273c52e7434e54f160bf2c9 to your computer and use it in GitHub Desktop.
Save TaylorJadin/4cdfb5ced273c52e7434e54f160bf2c9 to your computer and use it in GitHub Desktop.
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