2010/11/30

The example of using the command line, working with Web Emulator

Settings:

In addition to the program folder duplicating, there is another multithreaded Emulator settings option, which causes less confusion with scripts and templates. First, I should recall the following commands existence for the command line: / port: *** and / script: ***


The first runs the program on the specified port instead of asterisks, and the second loads and initiates the specified script simultaneously.


The example bat-file running five program copies:




start "XWeb Human Emulator" "D:\Xweb\Human Emulator MT\XWeb Human Emulator.exe" /port:"7010" /script:“D:\scripts\script7010.php”

ping -n 1 -w 5000 192.168.254.254 >nul

start "XWeb Human Emulator1" "D:\Xweb\Human Emulator MT\XWeb Human Emulator.exe" /port:"7011" /script:“D:\scripts\script7011.php”

ping -n 1 -w 5000 192.168.254.254 >nul

start "XWeb Human Emulator2" "D:\Xweb\Human Emulator MT\XWeb Human Emulator.exe" /port:"7012" /script:“D:\scripts\script7012.php”

ping -n 1 -w 5000 192.168.254.254 >nul

start "XWeb Human Emulator3" "D:\Xweb\Human Emulator MT\XWeb Human Emulator.exe" /port:"7013" /script:“D:\scripts\script7013.php”

ping -n 1 -w 5000 192.168.254.254 >nul

start "XWeb Human Emulator4" "D:\Xweb\Human Emulator MT\XWeb Human Emulator.exe" /port:"7014" /script:“D:\scripts\script7014.php”


(The command “ping -n 1 -w 5000 192.168.254.254> nul” used for making 5 seconds pause between program startups)


Usually, a simple batch file launch has little effect, because the program, running on different ports, will apply to one and the same- templates, which defines a single port (default 7010).


But it can be done "knight's move" - in each script, runing with the program, before templates connecting, to register:



$xhe_host="127.0.0.1:****";


The current program copy port number – where the stars are. It turns out, at the script “script7010.php” it will be “7010”, at “script7011.php” – “7011”, etc.



Usage

Only new scripts will require a reproduction at this program organization. Their difference from each other will be only in one of the first lines and the name. It is better to use the plug port number in the title for less confusion. It is also not cause problems to upgrade programs, because to update one copy - not the same like twenty.


Try to create a bat-file with the code above and put it in the scripts folder on the D: scripts with the names from “script7010.php” till “script7014.php”. They will have follow content:



$xhe_host="127.0.0.1:****";

require("C:/Program Files/XWeb/Human Emulator/Templates/xweb_human_emulator.php");

// navigate to google

$browser->navigate("http://www.google.com");

// wait on browser

$browser->wait(1);

// Quit

$app->quit();


But instead of stars there is the port number from the title. And, for clarity, the transition to Google can be replaced in every copy of the script to other site.


You’ll get five copies of the program after starting bat-file. Each of copies performs personally registered to her script.


BTW, the first program start like this can initiate quarrel, like “does not match the port in templates” - they can be ignored by putting and confirming this tick "Yes".

No comments:

Post a Comment