Launching Human Emulator Studio from the command line.

Launching Human Emulator Studio from the command line.

Command line options in Human Emulator Studio.
/port: “port” – indicates on which port the program is launched to receive control commands. If this parameter is not specified, the port is taken from the port.txt file in the Settings folder of the program. The port can be from 1 to 65535. For example, the /port: “7010” parameter – sets the port 7010 on which the program is running.

/script: “path to the script” – with the help of this parameter we specify which script to run in the program for execution. If the path to the script is not specified, the program is launched without executing the script. The path must be absolute, that is, for example: “C:\XWeb\Human Emulator Studio\My Scripts\1.php

/script_args: “space separated arguments” – arguments to be passed to the script being run. This parameter is used to pass any data to the script. For example, we pass: “7010 ‘1.txt’ 5″. All these values ​​will be placed in the array $argv[], that is, $argv[1] = 7010, $argv[2] =’1.txt’, and $argv[3] = 5. In this case, always $argv[0] = “path to the running script”, if the path is not specified then $argv[0] will be empty. The /port: parameter tells the whole program on which port to run, and to run the script, the port must be passed through the /script_args: parameter.

/browser_command_line: “space separated commands” – command line arguments for the Chromium browser. For example: /browser_command_line: “- disable-gpu —disable-headless-mode”. A list of available commands can be found here

/settings_folder: “path to folder” – path to the folder with settings. By default, all settings are stored in the Settings folder, which is located in the program folder. Using this parameter, you can specify a folder with settings for the program from anywhere. The path must be absolute, that is, for example: “C:\XWeb\Human Emulator Studio\Settings1

/cookies_folder: “path to the cookie folder” – set the path to the cookie folder. The path must be absolute, that is, for example: “C:\XWeb\Human Emulator Studio\7010\cookies_1

/cache_folder: “path to the cache folder” – set the folder to the cache folder. This is an obsolete parameter, since the cache folder is currently automatically placed inside the cookie folder.

/ask_port: “true” or /ask_port: “1” or /ask_port: “yes” – when starting the program, do not ask questions about switching to the next free port, if the current port is busy, then simply do not start the program.

/in_tray: “1” or /in_tray: “true” or /in_tray: “yes” – when launching, hide the program to the tray (system tray).

/hide_tray_icon: “1” or /hide_tray_icon: “true” or /hide_tray_icon: “yes” do not show the icon in the system tray (system tray).

/as_unicode: “1” or /as_unicode: “true” or /as_unicode: “yes” – the script is run in unicode format.

from version 7.0.44

/password: “psw” – to set the Password at startup setting.

/browser: “Chromium” or /browser: “Firefox” – select the browser model in which the script will be executed.

from version 7.0.47

/default_profile_path: “path” – to set the path to the default profile file.

from version 7.0.52

/decode_script_password: “password” – to pass the password when running the encoded script.

If the above parameters are not specified when starting the program from the command line, then the values ​​are taken from the program settings or take the default values.

Run the program from the command line.

How to run a program with command line parameters.

There are many ways to run with command line parameters. Consider the following:

Option 1 through a shortcut on the desktop.
Option 2 via a .bat file.

Desktop shortcut.

To do this, create a shortcut on the desktop, and then specify the command line launch parameters in the shortcut settings.

Our command line will be as follows:

/port: “7010” /script: “C:\XWeb\Human Emulator Studio\My Scripts\1.php” /script_args: “7010 ‘1.txt’ 5 “

Php script code to run from the command line:

After starting the program through this shortcut, the 1.php script will run and the following information will be displayed in the debug window:

Now, every time you run through this shortcut, we will run a script with the parameters specified in it.

Batch file

Batch file (.bat) are ordinary text files containing a set of commands and having the .bat extension. Any text editor will do for editing such a file. In this case, if you double-click on the file, then it will not open in the editor, but will execute the commands written in it.
In our case, we will register in this file the launch of the Human Emulator Studio program and pass command line parameters to it.

So, let’s run the program with the following command line /port: “7012” /script: “C:\XWeb\Human Emulator Studio\My Scripts\1.php” /script_args: “7012 ‘2332.txt’ 1123 ″. For clarity, we will run the program on port 7012 and use other arguments in this case.

Create a batch file and add the following line to it:

start “XHE Studio” “C:\XWeb\Human Emulator Studio\XWeb Human Emulator Studio.exe” /port: “7012” /script: “C:\XWeb\Human Emulator Studio\My Scripts\1.php” /script_args : “7012 ‘2332.txt’ 1123 ″.

The script will run the same one that was launched through the shortcut.

After starting the file, the program will open with the launch of the 1.php script for execution. After running the script, the following information will be displayed in the debug window:

Unlike a shortcut using a bat file, you can run several programs at once if you have a multi-threaded version of Human Emulator Studio.

In this case, our bat file will be like this:

start “XHE Studio” “C:\XWeb\Human Emulator Studio\XWeb Human Emulator Studio.exe” / port: “7012” / script: “C:\XWeb\Human Emulator Studio\My Scripts\1.php” /script_args : “7012 ‘2332.txt’ 1123 ″.
ping -n 2 localhost> nul
start “XHE Studio” “C:\XWeb\Human Emulator Studio 7011\XWeb Human Emulator Studio.exe” /port: “7011” /script: “C:\XWeb\Human Emulator Studio 7011\My Scripts\2.php” /script_args: “7011 ‘file.txt’ 123121 ″

Based on the results of the script, two programs will be launched and each of them will execute its own script.

You can read more about batch files and the commands they use here

Xhe local manager

XHE Local Manager.

XHE Local Manager is a separate free software that will help you work in multithreaded mode with the Human Emulator Studio.

Current version: 1.20.0

You can download the Manager on our forum, where you can also leave your suggestions and questions about the program.

See change log.

Software description

The Manager is used to run scripts in multithreaded mode. For this purpose, so-called tasks are used. In fact, the task is a script that will run its own exe human emulator in the amount specified in the task.

To run tasks, use software that are copied from the root folder of the program, which is defined in the settings as XHE Main Folder. When starting a task, the Manager, if the task is started for the first time, creates a folder with the task number and copies the Human Emulator there. The following runs use exe from the tasks folder. The software has the functionality to update all used Human Emulator.

The threads are updated from the XHE Main Folder, so if you want to update all the exe files in the tasks, you first update the XHE Main folder, and then on the Tasks tab, click the Update XHE button to update the selected task, or Update All XHE to update all the tasks.

Updates can be performed from disk or from ftp, http, sftp.
If the update is performed from disk, then a folder or zip archive is used as the update source. From other places — zip archive. Updates to human tasks are performed only from the root folder XHE Main Folder.

Login and password in the program settings is the username and password required to access the update source, i.e. access to ftp or http, where the zip archive is located for updating the XHE Main Folder. This archive must contain a version of the program that has already been activated for this computer, that is, the files code.txt and email.txt must be in its settings folder. Otherwise, when you run the task, you will be prompted to activate the program.

When the task is started, threads are started. These threads can be hidden, opened for viewing, and stopped, all at once, or only selected threads or tasks. To work in multithreaded mode, you need to adapt scripts to this task. The following variables are used for this purpose:

Through these variables, the script will receive the number of the thread that runs the script. That is, the numbers 0,1,2,3, etc., depending on the number of running threads. This is used to parallelize the execution of a task between running threads.

IMPORTANT: After installation, the program must run as an administrator.

Preparation of scripts

As noted in the section description of the program for working with the Manager, scripts must be adapted to work with this tool.

For a script to run in multiple threads, the beginning of the script must be as follows:

The first $xhe_host =”″; we specify that Human Emulator Studio does not change the second line $xhe_host =”$xhe_thread_port”; if this is set in the settings.

The $xhe_thread_num variable can be used to determine the current thread, for example, to write the results of work to a file.

In the folder Local Manager\My Scripts there are examples of scripts that we will use to create tasks. These same scripts can be viewed as an example for adapting your scripts to the Manager.

Program setting

Open the settings dialog using the menu or pressing the F9 key. See:

Where Source of XHE Update is the path to the program folder from which we will update the so-called XHE Main folder. The program from this folder will take the exe files and copy them to the threads to perform your tasks.

It is important that the Source path is real. Set it and click on the Update Main XHE Folder button. We are waiting for the program to copy the necessary files. At this time, the program window will not be available, but the panel with logs will display information that the copying started, and then that it ended.

The second tab of the settings dialog contains:

Refresh threads period (seconds) this is the refresh rate of the table of running threads in the Running Threads tab.

Auto restart threads by suspend – automatically restart fallen threads. If this check box is set in the program settings, the Manager will automatically restart threads that have fallen off during operation.

Working with tasks

Tasks are the main element of working with the Manager. For each of your scripts, you create your own task, where you specify the appropriate settings.

Creating a task

To add a new task, click the Add button. A dialog opens with several tabs.

The General tab is the name and description of the task.

The Threads tab is the number of threads and the path to the script, as well as the script arguments. By default, arguments contain the necessary arguments for operation. You can add your own through the space bar.

The Options tab is used to configure the operation of each exe thread being started. Here you may specify the folder with the cookies and settings for thread, browser command, and using the checkboxes to set: to curtail the run thread to tray — /in_tray, whether to hide the tray icon — /hide_tray_icon, to start a thread to work in unicode — /as_unicode, asking about change of port /ask_port, if a check is not worth it, the thread is automatic to move on to the next port when the configured port is busy. If this check box is selected, the thread will ask at startup before moving to the next port. And another check mark, use RT version, indicates whether to use the RT version or the full version of the program.

After we have set all the necessary settings for the task. Click the OK button. Our task will appear in the task table on the Tasks tab.

Task start

Now we can start it. To do this, click the Run button.

First, the program will create a tasks folder and a folder with the task number in it, to which it will copy the program to run threads from the XHE Main folder. After copying, the threads themselves are started. This opens the Running Threads tab with a table of running threads. The table displays data on these threads, the status of the scripts, and the amount of memory consumed by the threads.

On the same tab, you can update the table, you can do it automatically or by pressing a button, as well as leave the selected thread, show or hide the thread. When you click the Show button, the thread window will be expanded on top of other windows. When you click the Hide button, the selected thread will be hidden again. Accordingly, the Show All and Hide All buttons perform the same actions only for all threads at once.

In order to stop and close all threads at once on the Tasks tab, click the Stop button. You can also stop all tasks from running on this tab, as well as update programs that use tasks.

Running a scheduled task

The Manager also has functionality for running tasks on a schedule. It is very similar to the schedule for running scripts in the Human Emulator Studio.

To configure running tasks on a schedule, go to the Scheduler tab. And click on the Add button.

The task launch settings dialog opens.

Using this dialog, you specify the type of launch — it can be a single launch, a launch after a specified period of time, or an infinite (non-stop) launch. Here we specify the Start time, that is, the time of the first launch. Select the task that you want to run on a schedule. Write a comment on this task, and use the Active checkbox to set whether the launch will be active after creation. After all the settings have been set, click on the OK button.

Running on a schedule will appear in the table in the Scheduler tab.

On the same tab, in addition to adding a scheduled task launch. There are a number of buttons that allow you to edit, Activate or deactivate, delete the selected launch in the table, as well as buttons that allow you to do the same actions for all launches in the table.

You can use the Import All and Export All buttons to save launches to a json file or load them from it.