Archive for April 23rd, 2007

Windows Mobile + Twitter / Facebook = UltraStalk Hack

Monday, April 23rd, 2007

Well, I have done it. I have managed to bridge that gap between my computer and my toilet… or my computer and my drive to work… or my computer and those boring lectures at school…. I no longer have to suffer through the pain of not having access to my live feed of everyones life. I can now continue my daily stalk even when I am not at my computer.

If you are like me, you have your Facebook status update feed for all of your friends in your favorite feed reader and set it to update every 1 minute. You also added your friend’s Twitter feeds. You may have even taken advantage of Facebooks SMS notification feature, where it txt-msgs you whenever a friend updates their status… Well, that was not good enough for me, and only provided me with limited info on a few people… I wanted INSTANT access to my Facebook/Twitter stalking resources!

So, I found a way. I own a Motorola Q, and I love it. Despite all of the problems everyone has with it and what everyone says, I find it to be the most useful mobile tool I have. I watch TV on it (SlingBox + Comcast Digital Cable), listen to music on it (SiriusWM5 for Sirius, and Orb for mp3s from my large library on my desktop PC), play SNES games on it (thank you PocketNesterPlus), use it for GPS navigation & phone book (Windows Live Search), instant message from it (Agile Messenger), and of course that phone/email/web thing as well. I WANTED MORE!

I wanted to move my obsessive Facebook/Twitter habits into my mobile lifestyle so I could stalk on the go. Here is my solution:

ss000.jpg

Notice the information that I circled in red. This the latest Facebook update from my entire set of friends. “Katie S. is on her way to target.” My homescreen is updated every 3 minutes with the latest status update from Facebook. Whenever someone updates their status, my phone makes a very light noise and the update is displayed on my home screen. ULTRASTALK! I see all and hear all now.

And now, here is how it works. I found a scripting language that works on mobile phones and has a nice set of functions and features. It is called MortScript. MortScript has the ability to read/write to the registry, download and read files from the internet, automatically run at specified intervals, etc etc etc… I created a very simple script that checks a PHP file on a server of mine, and saves the information to the phone. Then I added a built-in plugin to the home screen that displays that information. I currently only have it doing a live Facebook status update, but the PHP script could easily be made to pull Twitter, or even BOTH. This MortSCript is only for displaying the information, so really, the PHP script could grab ANY type of information, such as: server status, new email, feed updates (such as facebook/twitter), IM presence information, number of users on your website, new comments on your blog, important alerts (like a pager?). Really, I have created the framework for any type of instant mobile alerts.

MortScript:

scriptURL = "URL_TO_YOUR_SCRIPT"
ThisScriptPath = SystemPath("ScriptPath")
ThisScriptName = SystemPath("ScriptName") & SystemPath("ScriptExt")

#Update interval in seconds, 180 = 3 minutes.
UpdateInterval = 180

Call SetUpdateTime

#Turn Errors OFF
ErrorLevel("off")

Contents = ""
wURL = scriptURL
Contents = ReadFile(wURL)
OldContents = RegRead ("HKCU","ControlPanelOwner","Notes")

If (OldContents ne Contents)
	#For the Q
	RegWriteString ("HKCU","ControlPanelOwner","Notes", Contents)

	#Uncomment the following and change filename to play a sound
	#PlaySound("NewUpdate.wav")
EndIf

Exit
# -------------------------------------------------------------
Sub SetUpdateTime
If (UpdateInterval <> 0)
	RunAtTime = TimeStamp() + (UpdateInterval)

	#Remove the Notification Queue (if exists)
	RemoveNotifications(ThisScriptPath & "\" & ThisScriptName)

	#Set the Notification Queue Item
	RunAt(RunAtTime, ThisScriptPath & "\" & ThisScriptName)
EndIf
EndSub

PHP Script

$url = 'FACEBOOK_STATUS_FEED_URL';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0");
$xml = curl_exec($ch);
curl_close($ch);

$xmlobj = simplexml_load_string($xml);
$status = $xmlobj->channel->item[0]->title;
$author = $xmlobj->channel->item[0]->author;
$authorn = split(' ',$author);

switch(count($authorn)):
case 1: // single name
    $authorabbr = $authorn[0];
    break;
case 2: // first & last name
    $authorabbr = $authorn[0].' '.$authorn[1]{0}.'.';
    break;
case 3: // first middle last, take first and last
case 4: // first middle last sr/jr/III, take first and last
    $authorabbr = $authorn[0].' '.$authorn[2]{0}.'.';
    break;
default:
    $authorabbr = 'Someone';
    break;
endswitch;

$status = str_replace($author, ucwords($authorabbr), $status);

echo $status;
?>

XML to add to your home screen file:


	
	

You will obviously need to customize the XML to suite your current home screen needs (x,y,height,width,font-size, etc etc). Follow this link to download MortScript and install it. Name the script above ultrastalk.mscr and run it from filemanager to start it. If anyone is actually interested in using this, just leave a comment and I will post a follow up with step-by-step instructions.