Skip to content

Instantly share code, notes, and snippets.

@moyashi
Last active April 21, 2024 14:22
Show Gist options
  • Save moyashi/7ee35b041f2654b5ab0669c98d84f286 to your computer and use it in GitHub Desktop.
Save moyashi/7ee35b041f2654b5ab0669c98d84f286 to your computer and use it in GitHub Desktop.
on split(str, delim)
local orgDelim, rtn
set orgDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to {delim}
set rtn to every text item of str
set AppleScript's text item delimiters to orgDelim
return rtn
end split
tell application "Spotify"
set ct to current track
set myartist to artist of ct
set myalbum to album of ct
set myname to name of ct
set myid to id of ct
set mylist to my split(myid, ":")
set myid to item 3 of mylist
set info to "\"" & myname & " / " & myartist & " from " & myalbum & "\" https://open.spotify.com/intl-ja/track/" & myid
end tell
tell application "Safari"
open location "https://twitter.com/intent/tweet?text=" & info
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment