Hi michael,
Thanxs for ur precious reply.. Sorry michael i couldnt get what u said i was trying the above operation but couldnt succeed... pLe if u dont mind can u please let me know in detail how to select putty system icon for copying it into clipboard...and by the way ple provide me with any help documentation for ranorex studio...will be awaiting for ur reply soon
regards
chandrashekar
Getting text from putty via Clipboard
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Hi chandrashekar,
when you left-click on the small icon on the upper-left corner of Putty's window, the system menu will pop up. There's a menu item called "Copy All to Clipboard" you should click on to copy all the text from the putty session to the clipboard. You can then use the Clipboard.GetText() method to retrieve this text in your code.
Just use the Ranorex Recorder to record the mouse clicks on the menu item and let the recorder generate the code for you.
You can find documentation on RanorexStudio on our homepage:
http://www.ranorex.com/gui-testing-guid ... tudio.html
Regards,
Alex
Ranorex Support Team
PS: If you want to respond to a forum post, you can also click the "PostReply" button instead of creating a new thread for each post.
when you left-click on the small icon on the upper-left corner of Putty's window, the system menu will pop up. There's a menu item called "Copy All to Clipboard" you should click on to copy all the text from the putty session to the clipboard. You can then use the Clipboard.GetText() method to retrieve this text in your code.
Just use the Ranorex Recorder to record the mouse clicks on the menu item and let the recorder generate the code for you.
You can find documentation on RanorexStudio on our homepage:
http://www.ranorex.com/gui-testing-guid ... tudio.html
Regards,
Alex
Ranorex Support Team
PS: If you want to respond to a forum post, you can also click the "PostReply" button instead of creating a new thread for each post.

-
- Posts: 11
- Joined: Wed Aug 13, 2008 8:27 am
logger info
Thanks Alex,
I never thought that i get reply so soon from this forum...I have one more thing to clarify, let me know how u would invoke putty through renorex studio.. i tried system.diagnostics cmd to invoke as u invoke anyother console...but i couldnt succeed calling PUTTY..could u ple help me out with this issue
regards
chandrashekar
I never thought that i get reply so soon from this forum...I have one more thing to clarify, let me know how u would invoke putty through renorex studio.. i tried system.diagnostics cmd to invoke as u invoke anyother console...but i couldnt succeed calling PUTTY..could u ple help me out with this issue
regards
chandrashekar
-
- Posts: 11
- Joined: Wed Aug 13, 2008 8:27 am
logger info-putty
Hi Alex,
I tried to do as u said,but i am facing a problem "The name 'Clipboard' doesnt exist in the current context" in the Ranorex studio...could u ple tell me what could be the problem...ple let me know the other version of using clipboard.GetText() command..
regards
chandrashekar
I tried to do as u said,but i am facing a problem "The name 'Clipboard' doesnt exist in the current context" in the Ranorex studio...could u ple tell me what could be the problem...ple let me know the other version of using clipboard.GetText() command..
regards
chandrashekar
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
You need to specify the exact path to your Putty.exe executable in the Process.Start or Ranorex.Application.StartWindowsApplication method.
The ClipBoard class is in the System.Windows.Forms namespace, so you might need to add a using statement and add a reference to the System.Windows.Forms DLL to your project.
Regards,
Alex
Ranorex Support Team
The ClipBoard class is in the System.Windows.Forms namespace, so you might need to add a using statement and add a reference to the System.Windows.Forms DLL to your project.
Regards,
Alex
Ranorex Support Team
-
- Posts: 11
- Joined: Wed Aug 13, 2008 8:27 am
logger info
Thanks alex,
Finally i got what i was trying
I added the System.windows.Form DLL in to my Reference...i included using system.windows.Form in the program.cs and i used Clipboard.getText()...what exact parameters i need to pass ??...i wanted a particular string to be found out of clipboard Content..how can i search in the Clipboard contents...If you help me out this i could finish off my automation part...please let me know ASAP
regards
chandrashekar
Finally i got what i was trying
I added the System.windows.Form DLL in to my Reference...i included using system.windows.Form in the program.cs and i used Clipboard.getText()...what exact parameters i need to pass ??...i wanted a particular string to be found out of clipboard Content..how can i search in the Clipboard contents...If you help me out this i could finish off my automation part...please let me know ASAP
regards
chandrashekar
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
The Clipboard is a .NET framework class, please consult the MSDN documentation for the exact parameters to its methods.
You might also want to take a look at the documentation of the .NET string class that provides methods to search in strings.
Regards,
Alex
Ranorex Support Team
You might also want to take a look at the documentation of the .NET string class that provides methods to search in strings.
Regards,
Alex
Ranorex Support Team
-
- Posts: 11
- Joined: Wed Aug 13, 2008 8:27 am
pseudo code - putty
Alex,
i have pasted the code for clipboard control...please correct me,i am facing problem executing that...kindly help me out,its very important for me.
steps : assume u have copied the contents from putty now u want to access it in your ranorex studio...just see the try block and let me know what has to be done...bcoz when i execute that piece of code i am getting errors thats y !!!
using System;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Ranorex;
namespace MemCPU
{
class Program
{
[STAThread]
public static int Main(string[] args)
{
int error = 0;
string str;
Logger.LogFileTitle = "Ranorex Log File";
Logger.Initialize(false, "test1.txt", "test1.xml", LogLevel.Info);
try
{
Automation.Test1(); //contains code for executing cmd and copying contents into clipboard
Dim idata as IDataObject = Clipboard.GetDataObject();
if iData.GetDataPresent(DataFormats.Text)
{
str = (String)iData.GetData(DataFormats.Text);
}
else
{
str = "Could not retrieve data off the clipboard.";
}
}
catch (ValidationException)
{
Logger.Error("Validation failed!");
error = -1;
}
i have pasted the code for clipboard control...please correct me,i am facing problem executing that...kindly help me out,its very important for me.
steps : assume u have copied the contents from putty now u want to access it in your ranorex studio...just see the try block and let me know what has to be done...bcoz when i execute that piece of code i am getting errors thats y !!!
using System;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Ranorex;
namespace MemCPU
{
class Program
{
[STAThread]
public static int Main(string[] args)
{
int error = 0;
string str;
Logger.LogFileTitle = "Ranorex Log File";
Logger.Initialize(false, "test1.txt", "test1.xml", LogLevel.Info);
try
{
Automation.Test1(); //contains code for executing cmd and copying contents into clipboard
Dim idata as IDataObject = Clipboard.GetDataObject();
if iData.GetDataPresent(DataFormats.Text)
{
str = (String)iData.GetData(DataFormats.Text);
}
else
{
str = "Could not retrieve data off the clipboard.";
}
}
catch (ValidationException)
{
Logger.Error("Validation failed!");
error = -1;
}
-
- Posts: 11
- Joined: Wed Aug 13, 2008 8:27 am
finally solved-putty
Alex,
I have done what ever u suggested me...just check with my code bcoz i was facing trouble with my verification...let me know what i should do...everything works fine..thanks for everything
regards
chandrashekar
IDataObject idata;
Logger.LogFileTitle = "Ranorex Log File";
Logger.Initialize(false, null, "test1.xml", LogLevel.Info);
try
{
Automation.Test1(); // Invoke putty
Automation.Test2(); // mouse move on putty system menu
idata = Clipboard.GetDataObject();
if(idata.GetDataPresent(DataFormats.Text))
{
str = (String)idata.GetData(DataFormats.Text);
Logger.Info("contents copied into Clipboard...");
res = str.Contains(searchstr);
Logger.Info("Finding CPU Model in Clipboard...");
Validate.AreEqual(res,"True","CPU Model String Not present"); }
else {
str = "Could not retrieve data off the clipboard.";
}
Logger.OpenLogViewer();
}
I have done what ever u suggested me...just check with my code bcoz i was facing trouble with my verification...let me know what i should do...everything works fine..thanks for everything
regards
chandrashekar
IDataObject idata;
Logger.LogFileTitle = "Ranorex Log File";
Logger.Initialize(false, null, "test1.xml", LogLevel.Info);
try
{
Automation.Test1(); // Invoke putty
Automation.Test2(); // mouse move on putty system menu
idata = Clipboard.GetDataObject();
if(idata.GetDataPresent(DataFormats.Text))
{
str = (String)idata.GetData(DataFormats.Text);
Logger.Info("contents copied into Clipboard...");
res = str.Contains(searchstr);
Logger.Info("Finding CPU Model in Clipboard...");
Validate.AreEqual(res,"True","CPU Model String Not present"); }
else {
str = "Could not retrieve data off the clipboard.";
}
Logger.OpenLogViewer();
}
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
You are comparing a bool to a string instance (variable res is obviously a bool, "True" a string). That can't work.
Replace the "True" literal with the true keyword or use the Validate.IsTrue method:
Regards,
Alex
Ranorex Support Team
Replace the "True" literal with the true keyword or use the Validate.IsTrue method:
Code: Select all
Validate.AreEqual(res,true,"CPU Model String Not present");
// or
Validate.IsTrue(res, "CPU Model String Not present");
Alex
Ranorex Support Team
-
- Posts: 11
- Joined: Wed Aug 13, 2008 8:27 am
Ranorex
Hi
Thanks for everything...I got what i was trying...
regards
chandrashekar
Thanks for everything...I got what i was trying...
regards
chandrashekar