Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Put this script into ~/Library/iTunes/Scripts and tweet your songs via Tweetbot
-- TweetSongViaTweetbot.applescript
-- Copy title, artist, album and year of playing song from iTunes to Tweetbot
-- Author: Sascha Foerster
-- based on script from: Romain Briche
-- iTunes and Tweetbot active?
tell application "System Events"
if not (exists application process "Tweetbot") or not (exists application process "iTunes") then
display alert "iTunes and Tweetbot required" message "You have to launch iTunes and Tweetbot before executing script"
end if
end tell
-- Get Title and Artist from iTunes
tell application "iTunes"
set var_name to the name of the current track
set var_albumartist to the album artist of the current track
set var_album to the album of the current track
set var_year to year of the current track
--set track to track
end tell
--Generate Tweettext
on copySongToTweetbot(var_name, var_albumartist, var_album, var_year)
tell application "System Events"
set tweet to "♫♪♫ Ich höre gerade \"" & var_name & "\" von " & var_albumartist & " (" & var_album & ", " & var_year & ")"
set the clipboard to tweet as text
delay 0.2 -- to make sure the clipboard will be set correctly
keystroke "n" using {command down}
keystroke "v" using {command down}
delay 0.2 -- to make sure the clipboard will be set correctly
end tell
end copySongToTweetbot
-- Activate Tweetbot and paste the tweet text
tell application "Tweetbot" to activate
set theClipboard to the clipboard
copySongToTweetbot(var_name, var_albumartist, var_album, var_year)
set the clipboard to theClipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.