Free Information Technology Magazines and eBooks

Friday, October 09, 2009

Remotely control your PC using Twitter Tweets

Remotely control your PC using Twitter TweetsIf your a social media addict and you can't get off your hands on it then you may like this cool opensource software called TweetMyPC. As the name implies, it allows you to remote control your PC by just posting tweets at Twitter. The app allows you to shutdown, restart or log off your Windows PC, remotely via your Twitter account. Its latest version, TweetMyPC 2.0, has lots of new features which includes screenshot, memory usage, ip address, custom commands, reply from TweetMyPC and lots more.



To use TweetMyPC, just download the installer, install, and run the app. On the taskbar, double-click its icon to display the Settings dialog box. Enter your twitter account then click the "save and close" button, TweetMyPC will automatically login to your twitter account and watch for any updates every minute.


Here is a sample Tweet command and reply


TweetMyPC was developed using VB.NET. It uses the Yedda Twitter .NET Library that wraps most of the Twitter API providing a direct access to the various methods and output formats used on the Twitter API. Here are some code snippets from the project.

Login to specified Twitter Account


'Check for valid Username and Password
Dim objTwitter As New Yedda.Twitter
Dim Updates As XmlDocument
Try 'Try Logging in
Updates = objTwitter.GetUserTimelineAsXML(txtUserName.Text.Trim, txtPassword.Text.Trim)
My.Settings.UserName = txtUserName.Text.Trim
My.Settings.Password = txtPassword.Text.Trim

Catch ex As Exception
MsgBox("Failed to Login to Twitter with the values supplied. Please check your login details.")
txtUserName.Focus()
Exit Sub
End Try


Save settings to DB using SQLite.



Dim STR_CONNECTIONSTRING As String
Dim STR_APP_FOLDER_LOCATION As String
STR_APP_FOLDER_LOCATION = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\") + 1)
STR_CONNECTIONSTRING = "Data Source= " & STR_APP_FOLDER_LOCATION & "DB.s3db;"
SQLConnect.ConnectionString = STR_CONNECTIONSTRING
Try
SQLConnect.Open()
SQLCommand = SQLConnect.CreateCommand
Catch ex As Exception
MsgBox(ex.Message + "Sorry. Please try again")
End Try
SQLCommand.CommandText = ""
SQLCommand.CommandText = "DELETE FROM Settings"
SQLCommand.ExecuteNonQuery()
'MsgBox("Succesfully deleted")
SQLCommand.CommandText = ""
SQLCommand.CommandText = "INSERT INTO Settings (TwitterUserName, TwitterPassword, GmailUserName, GmailPassword, DownloadLocation) VALUES ('" + txtUserName.Text.Trim + "','" + EncryptString(txtPassword.Text.Trim) + "','" + txtEmailUsername.Text.Trim + "','" + EncryptString(txtEmailPassword.Text.Trim) + "','" + txtDownloadLocation.Text.Trim + "')"
SQLCommand.ExecuteNonQuery()
'MsgBox("Succesfully inserted")

Try
SQLConnect.Close()
SQLCommand.Dispose()
Catch ex As Exception
MsgBox(ex.Message)
End Try



Download TweetMyPC Setup Package via [Codeplex].
Download the full sourcecode of TweetMyPC v2.0 via [Codeplex].
All the available Tweet commands are listed here.

For more opensource softwares, subscribe now.

0 comments: