Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on linkinuscmd(cmd)
  2.     set defaultString to "/me is currently not running Spotify."
  3.    
  4.     tell application "System Events"
  5.         set MyList to (name of every process)
  6.     end tell
  7.    
  8.     tell application "System Events" to set appList to ¬
  9.         name of application processes whose frontmost is true
  10.    
  11.     set activeApp to item 1 of appList
  12.    
  13.     if (MyList contains "Spotify") is true then
  14.         set theSong to do shell script ¬
  15.             "syslog -F '$(Message)' -E none -d -w 1 -k Sender GrowlHelperApp | while read song; do
  16.                 if [[ `echo $song | grep \"^Spotify:\"` ]]; then
  17.                     echo \"$song)\"
  18.                     killall syslog
  19.                     exit
  20.                 fi
  21.                
  22.              done"
  23.     end if
  24.    
  25.     if "Spotify:" is in theSong then return "/me " & theSong
  26.    
  27.     return defaultString
  28. end linkinuscmd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement