Starting a Program using Skype

Introduction

After some workaround through skype. I found a way to start a exe or a program (ex: NotePad) through a skype message.

This is a simple approach to access a machine remotely through skype. We can access a machine through internet. Please find the concept as below.

Concept behind approach

Normally all message pinged in skype are stored as a .db file which actually named as "Main.db" and it is located in"C:/Users/{desktop - username}/AppData/Roaming/skype/{skype - username}/main.db". So we can get the messages which are all pinged.

Code word for the approach

We have to maintain a code word that initiate the process. And the code should associate with time and date. since the code word may also present in the main.db. ex: "Start Notepad 7/10/2013 1:09"

C# Code snippet for the approach                          

      // source file of the message

        string path = "C:/Users/{desktop - username}/AppData/Roaming/skype/{skype - username}/main.db";

        // get a copy of source file since the original source file is always accessible by skype

        string targetPath = "C:/Temp/main.db";

        System.IO.File.Copy(path, targetPath, true);

 

        // Read the file for a command that open a notepad

        using (StreamReader sr = File.OpenText(targetPath))

        {

            string s = "";

            while ((s = sr.ReadLine()) != null)

            {

                string date = DateTime.Now.Date.ToString(); //get current date time of the machine to compare the command

                date = date.Replace(" 00:00:00", " ");

                if (s.Contains("Start NotePad" + date + DateTime.Now.Hour + ":" + DateTime.Now.Minute))  //checking the current date time with the command

                {

                    Process.Start("newtext.txt");  // your desire action

                }

            }

        }

        File.Delete(targetPath); 
             
Note: The above code should call frequently for latest update of the skype message

Ebook Download
View all
Learn
View all