Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Revised to use plist, passwords, and update skype' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Revised to use plist, passwords, and update skype
Authored by: nlb666 on Oct 24, '08 03:43:06PM

Great hint! I played around with this a little as we're just getting our twittering rolling over at liketribe, and derived the following shell script that would update your Adium and Skype status from twitter even if your twitter updates are protected, plus a plist to go with it. The script could be a little more succinct, but at least its relatively easy to read and mod if desired.

  • Save the following in ~/Library/Scripts as "sync-status-with-twitter.sh"
    
    #/bin/sh
    userid=$1
    password=$2
    message=`curl -s -u $userid:$password "http://twitter.com/statuses/user_timeline/$userid.atom?count=1" | grep '<entry>' -A 5 | grep "<title>" | perl -pi -e "s/<title>|<\/title>|$userid:| //g" | perl -pi -e 's/"/\\"/g'`
    
    osascript -e "tell application \"System Events\"
    if exists process \"Adium\" then
       tell Application \"Adium\"
          set the status message of every account whose status type is available to \"$message\"
       end tell
    end if
    if exists process \"Skype\" then
       tell Application \"Skype\"
          send command \"SET PROFILE MOOD_TEXT\" & \"$message\" script name \"updater\" 
       end tell
    end if
    end tell"
    
  • Save the following as in ~/Library/LaunchAgents as com.liketribe.twitterstatus.plist. Replace YOUR TWITTER NAME, YOUR TWITTER PASSWORD, and YOUR HOME DIRECTORY with the appropriate values.
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.liketribe.twitterstatus.plist</string>
        <key>ProgramArguments</key>
        <array>
            <string>/bin/sh</string>
            <string>/Users/YOUR HOME DIRECTORY/Library/Scripts/sync-status-with-twitter.sh</string>
            <string>YOUR TWITTER USER ID</string>
            <string>YOUR TWITTER PASSWORD</string>
        </array>
        <key>RunAtLoad</key> <false/>
        <key>StartInterval</key> <integer>300</integer>
    </dict>
    </plist>
    
  • Execute "launchctl load ~/Library/LaunchAgents/com.liketribe.twitterstatus.plist" to get this running in the background updating every 300 seconds. You can test first by executing "sh ~/Library/Scripts/sync-status-with-twitter.sh YOUR-TWITTER-ID YOUR-TWITTER-PASSWORD" (substituting your twitter id and password of course) to make sure all is well. Skype for example might ask you to grant permissions to the script the first time you execute it.


  • [ Reply to This | # ]