PHP example:
<?php $xhe_host = "127.0.0.1:7011"; $xhe_host = "127.0.0.1:7011"; //connect the object to control the emulator, if not already connected if(!isset($path)) $path = "../../../Templates/xweb_human_emulator.php"; require($path); //Start echo "<hr> <font color = blue> app->".basename(__FILE__)."</font> <hr>"; //1 echo "1.Print command line arguments: <br> <br>"; $out = $app->get_port().":"; if(count($argv)> = 1) $out.= "argv [0] =".$argv [0]."<br>"; if(count($argv)> = 2) $out.= "argv [1] =".$argv [1]."<br>"; if(count($argv)> = 3) $out.= "argv [2] =".$argv [2]."<br>"; if(count($argv)> = 4) $out.= "argv [3] =".$argv [3]."<br>"; //output echo $out; $app->set_title($out); //pause sleep(3); //reload the application and run the script if($argv [1] == "") $app->restart("restart.php", "1_1 1_2 1_3", "7011"); if($argv [1] == "1_1") $app->restart("restart.php", "2_1 2_2 2_3", "7011"); if($argv [1] == "2_1") $app->restart("restart.php", "3_1 3_2 3_3", "7011", "new_cookies_folder", "new_cache_folder", 10); if($argv [1] == "3_1") { sleep(3); $app->restart("restart.php", ""); } //end echo "<hr> <br>"; //Quit $app->quit(); ?>
Python example:
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7011" from xweb_human_emulator import * # Start echo("<hr> <font color = blue> app.xxxxxxxxx </font> <hr>") # 1 echo("1.Print command line arguments: <br> <br>") if len(sys.argv)> = 1: echo("argv [0] =" + sys.argv [0], "<br>") if len(sys.argv)> = 2: echo("argv [1] =" + sys.argv [1], "<br>") if len(sys.argv)> = 3: echo("argv [2] =" + sys.argv [2], "<br>") if len(sys.argv)> = 4: echo("argv [3] =" + sys.argv [3], "<br>") #pause sleep(3) # reload the application starting the script if len(sys.argv) == 1: app.restart("restart.py", "1_1 1_2 1_3", "7010") if sys.argv [1] == "1_1": app.restart("restart.py", "2_1 2_2 2_3", "7011") if sys.argv [1] == "2_1": app.restart("restart.py", "3_1 3_2 3_3", "7012", "new_cookies_folder", "new_cache_folder", 10) # end echo("<hr> <br>") # Quit app.quit()
C# example:
#region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; #endregion class Program: XHEScript { static void Main(string [] args) { //init XHE server = "127.0.0.1:7013"; InitXHE(); //Start echo("<hr> <font color = blue> app.restart </font> <hr>"); //1 step echo("1.Print command line arguments: <br> <br>"); if(args.Length> = 1) echo("args [0] =" + args [0] + "<br>"); if(args.Length> = 2) echo("args [1] =" + args [1] + "<br>"); if(args.Length> = 3) echo("args [2] =" + args [2] + "<br>"); if(args.Length> = 4) echo("args [3] =" + args [3] + "<br>"); //pause sleep(5); //reload the application and start the script if(args.Length == 0) app.restart("restart.cs", "1_1 1_2 1_3", "7010"); if(args [0] == "1_1") app.restart("restart.cs", "2_1 2_2 2_3", "7011"); if(args [0] == "2_1") app.restart("restart.cs", "3_1 3_2 3_3", "7012", "new_cookies_folder", "new_cache_folder"); //end echo("<hr> <br>"); app.quit(); } }
Java Script example:
//connect the object to control the emulator, if not already connected xhe_host = "127.0.0.1:7018"; echo = require("../../../Templates JS/xweb_human_emulator.js"); //Start echo("<hr> <font color = blue> app.restart </font> <hr>"); //command line arguments var argv = process.argv; //1 step echo("1.Print command line arguments: <br> <br>"); if(argv.length> = 1) echo("argv [0] =" + argv [0] + "<br>"); if(argv.length> = 2) echo("argv [1] =" + argv [1] + "<br>"); if(argv.length> = 3) echo("argv [2] =" + argv [2] + "<br>"); if(argv.length> = 4) echo("argv [3] =" + argv [3] + "<br>"); //pause browser.sleep(10); //restart { //reload the application and start the script if(argv [1] == "") app.restart("restart.php", "1_1 1_2 1_3", "7010"); if(argv [1] == "1_1") app.restart("restart.php", "2_1 2_2 2_3", "7011"); if(argv [1] == "2_1") app.restart("restart.php", "3_1 3_2 3_3", "7012", "new_cookies_folder", "new_cache_folder"); app.restart("restart.php", "1_1 1_2 1_3", "7010"); } //end echo("<hr> <br>"); //Quit app.quit();