#include "base64.jsxinc" var uid = 'user'; // user is your user name of Twitter account var pass = 'password'; // password is your password of Twitter account var uid64 = base64encode(uid + ':' + pass); function tweet(ttxt) { send = ""; conn = new Socket; var stxt = "status=" + encodeURI (ttxt); var tlength = stxt.length; if (tlength > 150) { var tover = tlength - 150; alert("Your message is too long: " + tover + " over") } else { var txt = "POST /statuses/update.json HTTP/1.0\n"; txt += "Authorization: Basic " + uid64 + "\n"; txt += "Content-Type: application/x-www-form-urlencoded\n"; txt += "Content-length: " + tlength + "\n\n"; txt += stxt + "\n"; if (conn.open("twitter.com:80")) { conn.write (txt); reply = conn.read(); conn.close(); } } } function createUI(thisObj) { var myPanel = thisObj; tweetBox = myPanel.add("edittext", [10, 10, 240, 30],); tweetButton = myPanel.add("button", [10, 40, 60, 60], "Tweet"); tweetButton.onClick = function() {tweet(tweetBox.text)}; return myPanel; } createUI(this);