English|Deutsch
Subscribe Ranorex Announcements Feed Ranorex LinkedIn Ranorex twitter Ranorex Facebook

SharpDevelop


Create a new Solution

Click 'File' | 'New' | 'Solution' and choose a 'Console Application'.
Open the 'Compiling' tab from the project's properties dialog by selecting the menu item 'Project' | 'Properties' | 'Compiling' and setup the 'Output Path'.
Copy the components 'RanorexCore.dll', 'RanorexSpy.dll' and 'RanorexNet.dll' from the 'bin' folder of your Ranorex installation path in the output path of your project. Right-click the 'References' folder within the 'Project Explorer' to add 'RanorexNet.dll' from the 'bin' directory of your project.
Open the file 'main.cs'.
Add the following code lines at the top of the file:
using System.Drawing;
using Ranorex;
Insert following code into the 'Main' function:
Console.WriteLine("Start Ranorex SharpDevelop sample1!");
//-----------------------------------------------------------------
// F O R M   search and test, Activate = true, Timeout = 5000 msec
//-----------------------------------------------------------------
Form form = Application. FindFormClassName ("SciCalc");
if ( form == null )
{
      Console.WriteLine("Start tested application");
      Application.Start("calc.exe");
      form = Application. FindFormClassName ("SciCalc",1, true ,5000);
      if ( form == null )
      {
            Console .WriteLine("Application calc.exe not found");
            return ;
      }
}
 
Console .WriteLine("Searching and testing button1");
Control button1= form.FindChildText("1");
if ( button1 == null )
{
      Console.WriteLine("ERROR: button1 not found ");
      return ;
}
 
if ( Mouse.ClickControl(button1) != 0 )
{
      Console.WriteLine("ERROR: pressing button1");
      return ;          
}
 
Console .WriteLine("Searching and testing button9");
Control button9 = form.FindChildText("9");
if ( button9 == null )
{
      Console.WriteLine("ERROR: button9 not found ");
      return ;
}
if ( Mouse.ClickControl(button9) != 0 )
{
      Console.WriteLine("ERROR: pressing button9");
      return ;          
}          
 
Console .WriteLine("Closing application");
Application .Sleep(2000);
form. Close ();
Build and run your application.