There are two ways to work with a program using C # code.
- Writing scripts in C # in the program.
- Connecting separately written applications to the Human Emulator functionality.
Both methods use the XHE.dll library. The only differences are that when writing scripts in the program you do not need to connect the library, since it is already connected, and when creating separate projects you will need to connect this library.
This dll library is a set of all objects and their functions that exist in the program.
A detailed description of the functionality of the objects can be found in our official documentation. The description for each function includes an example in C#.
The library was added to the program along with sources that are in the folder “folder with the program\Templates CSHARP\Lib\XHE\ XHE.sln“. The library sources are opened using Microsoft Visual Studio. If for some reason you need to make your changes to our library, you open the project in Microsoft Visual Studio, add your code there and then compile. The library connected to the Human Emulator is in the folder “folder with the program\Templates CSHARP\Lib\XHE\XHE\bin\Release\XHE.dll“. The main thing to note is that with the release of the new version, you will again have to reduce the library code, adding your changes to it. Whatever you do, you can send your code to us and we will add it to all subsequent versions of the program, but in this case your code will be available to all users of Human Emulator.
The library has been added to both “Human Emulator” (based on Internet Explorer) and “Human Emulator Studio” (based on Chromium) ranges. Work with the library in all versions of the program is completely identical. The differences are only in the available functionality.
Writing scripts in C # in a program.
To create a script in C # in the Human Emulator, just click on the File menu, point to New, and then click C# Script.
The “0.cs” script will open in the Scripts Editor with the following code:
static void Main(string args)
// init XHE
server = "127.0.0.1:7010";
// go to google
echo("Go to Google : "+browser.navigate("google.com"));
The first part of the script is used to allow the use of types in the namespace.
The second part is the script itself. The InitXHE function is the entry point for every the Human Emulator objects. This function is called before using any program object. Without this call, you cannot work normally with it. After calling this function, work is going on with objects. In this case, it is browser.navigate(“google.ru”) and app.quit ();.
When the script is executed, it is compiled into EXE file and this EXE file is launched. Exe itself appears in the folder with the script and later it can be run as a regular EXE file. The main thing is that at the same time the Human Emulator would be opened. In it all the actions prescribed in EXE file will be performed.
Connecting third-party projects to the Human Emulator functionality.
In this case, you connect the xhe.dll library to your project just like any other.
After that, all objects and functions for controlling the Human Emulator become available in your project.