SkypeのムードメッセージをTwitterに投稿するAppleScript
探しても見つからなかったのでリハビリを兼ねて自分で書いてしまった。ま、書き終わってから見つかるというオチな気が。
http://www.latenightsw.com/freeware/XMLTools2/ を入れないと動きません。あしからず。
-- Skype to Twitter status exporter -- You need -- http://www.latenightsw.com/freeware/XMLTools2/ -- to get this to work. set skypeMoodtextRetrievalCommand to "PROFILE MOOD_TEXT" set twitterStatusUpdateURL to "http://twitter.com/statuses/update.xml" -- Specify your account / password here: set twitterCredential to "yourname:yourpassword" try tell application "Skype" set moodMessage to send command "GET " & skypeMoodtextRetrievalCommand script name "Twtr" end tell on error errorMessage display dialog "Could not retrieve the mood message: " & ¬ return & errorMessage return end try if moodMessage does not start with skypeMoodtextRetrievalCommand then display dialog "Skype returned uninterpretable result." return end if set moodMessage to text ((length of skypeMoodtextRetrievalCommand) + 2) thru (length of moodMessage) of moodMessage try set resultXML to do shell script "curl" & ¬ " -u " & quoted form of twitterCredential & ¬ " -F status=" & quoted form of moodMessage & ¬ " " & quoted form of twitterStatusUpdateURL on error errorMessage display dialog "Could not update Twitter status: " & ¬ return & errorMessage return end try try set theXML to parse XML resultXML set newStatusMessage to the XML contents of the item 3 of XML contents of theXML as string if moodMessage is not equal to newStatusMessage then display dialog "Could not update Twitter status: " & ¬ return & "current status message is: " & newStatusMessage return end if on error errorMessage display dialog "Could not parse the resulting XML: " & ¬ return & errorMessage end try
追記: むー、行末の "¬" が全部化けてしまっているかも。
追記2: iTunes の現在再生中の曲名を上げるスクリプトもあった。こちらは credential の管理にキーチェーンを使っているのか。。。