Page 1 of 1

How do I use CloseApplication?

Posted: Mon Oct 05, 2015 11:16 am
by stapes
Again, I am struggling tring to glean any useful information from this:

http://www.ranorex.com/Documentation/Ra ... tion_1.htm

How do I use this close method?

What kind of Element is indicated by the parameter? (It won't compile without parameters. Documentation gives no indication what the defaults/required fields might be)

Examples please!

Re: How do I use CloseApplication?

Posted: Mon Oct 05, 2015 1:42 pm
by krstcs
If you don't understand how to read .NET APIs then I would suggest that you don't need to be writing .NET code. These APIs are easy to understand if you know how .NET works.

I would suggest that you either need to use basic Ranorex functionality and not try to code things yourself, or you need to take some time and learn how .NET works. There are numerous resources on the internet and thousands of books on .NET and learning how to code in an Object Oriented language available to help you.

Re: How do I use CloseApplication?

Posted: Mon Oct 05, 2015 1:49 pm
by stapes
With respect krstcs, I have been programming since 1978, the last several years of which I have been coding ASP.NET with C# and VB.

I also know how to read.

My question was not about .NET, but about how to use this particular function of Ranorex.

Re: How do I use CloseApplication?

Posted: Mon Oct 05, 2015 2:42 pm
by krstcs
I'm sorry if I offended you, that wasn't my intention. From the questions asked I had the impression that you did not know how to code and specifically how to use .NET. I apologize if that is not the case.

The Element class represents a UI element in the global UI tree (as demonstrated by RanorexSpy's tree view). From the API entry for the Element class: "Represents an UI item in the global UI tree. Instances of this class dynamically implement a Role and optional Capabilities, as well as numerous standard properties." The Element class entry is found in the Ranorex.Core Namespace section of the API. For any given Adapter, you can use the Element property to return an Element object that represents the element in the UI.

Where MyRepoObject is an object in your repository:

Code: Select all

Host.CloseApplication(MyRepoObject.Element, 10000);
For a rooted folder, use the Self property:

Code: Select all

Host.CloseApplication(MyRepoFolder.Self.Element, 10000);

Re: How do I use CloseApplication?

Posted: Mon Oct 05, 2015 8:39 pm
by stapes
OK. I solved this problem by recording Alt + F4.