I am trying to open hypertrm.exe
using myProcess.StartInfo.FileName = @"hypertrm.exe";
in c#.Now as per my requirement i need to login into the machine by entering username and password.For login to the machine i am writing following commands ..
Process hyperProcess = new Process();
hyperProcess.StartInfo.FileName = @"hypertrm.exe";
hyperProcess.EnableRaisingEvents = true;
hyperProcess.Start();
if (hyperProcess.Responding)
{
string username = "username";
System.Windows.Forms.SendKeys.SendWait(username + "{ENTER}");
Application.DoEvents();
Thread.Sleep(5000);
//Similarly Entered Password
}
Now as soon as Username,password entered correctly text data will be dispalyed into the hyperterminal window.Now how can i write that data into text file programmatically using c#.
Here is my updated code by which i want to open .ht file which i created as connection file and now i want to open with the help of hyperterminal and execute some commands in the hyperterminal.
var fileToOpen = @"D:\HyperTerminal\test.ht";
var myProcess = new Process();
myProcess.StartInfo = new ProcessStartInfo()
{
UseShellExecute = true,
FileName = fileToOpen
};
myProcess.Start();
if (myProcess.Responding)
{
string username = "";
System.Windows.Forms.SendKeys.SendWait(username + "{ENTER}");
Application.DoEvents();
Thread.Sleep(5000);
string password = "";
System.Windows.Forms.SendKeys.SendWait(password + "{ENTER}");
Application.DoEvents();
Thread.Sleep(5000);
string Command = "";
System.Windows.Forms.SendKeys.SendWait(Command + "{ENTER}");
Application.DoEvents();
Thread.Sleep(5000);
using (var writer = new StreamWriter(@"E:/Hyper/data.txt"))
{
writer.Write(myProcess.StandardOutput.ReadToEnd());
}
myProcess.Close();
}
}
catch
{
}
Now i want to know that is my approach correct to get the data from the hyper terminal.
Please help me ..Thanks in advance..