Forked from romainbriche/TweetViaTweetbot.applescript
Last active
January 12, 2018 21:51
-
-
Save saschafoerster/4692982 to your computer and use it in GitHub Desktop.
Put this script into ~/Library/iTunes/Scripts and tweet your songs via Tweetbot
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
-- 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