humanemulator.net — справка. Продукт, демо и покупка — на хуманэмулятор.рф | Демо | Купить | API | Changelog

run_as_console

run_as_console($path,$show=false,$params="",$encoding="",$timeout=3000); -

:

  • $path exe
  • $show ? /
  • $params
  • $encoding
  • $timeout ,

    :
  • N/A
  • / null

    <?php
    // Scenario: Run console applications with different visibility and parameters
    $xhe_host = "127.0.0.1:5006";
    if (!isset($path)){
        // Path to the init.php file for connecting to the XHE API
        $path = "../../../Templates/init.php";
        // Including init.php grants access to all classes and functionality for working with the XHE API
        require($path);
    }
    
    // beginning
    echo "\n<font color=blue>app->" . basename (__FILE__) . "</font>\n";
    
    // Example 1
    echo "\n\n1. Run in hidden state without parameters\n";
    $executablePath = 'C:\Windows\System32\PING.EXE';
    $showWindow = false;
    $parameters = "";
    $runResult = WINDOW::$app->run_as_console($executablePath, $showWindow, $parameters);
    if ($runResult) {
    	echo "Console executed successfully in hidden state\n";
    } else {
    	echo "Console execution failed in hidden state\n";
    }
    
    sleep(2);
    
    // Example 2
    echo "\n\n2. Run in visible state without parameters\n";
    $showWindow = true;
    $runResult = WINDOW::$app->run_as_console($executablePath, $showWindow, $parameters);
    if ($runResult) {
    	echo "Console executed successfully in visible state\n";
    } else {
    	echo "Console execution failed in visible state\n";
    }
    
    // Example 3
    echo "\n\n3. Run in visible state with parameters\n";
    $parameters = "ya.ru";
    $runResult = WINDOW::$app->run_as_console($executablePath, $showWindow, $parameters);
    if ($runResult) {
    	echo "Console executed successfully with parameters\n";
    } else {
    	echo "Console execution failed with parameters\n";
    }
    
    // end
    echo "\n";
    
    // Quit the application
    WINDOW::$app->quit();
    ?>
    # Additional paths
    import sys
    sys.path.insert(0, '../../../Templates PY/')
    
    xhe_host = "127.0.0.1:7023"
    from xweb_human_emulator import *
    
    # 
    echo("<hr><font color=blue>app.xxxxxxxxx</font><hr>")
    
    # 1 
    echo("1.       : \n");
    echo(app.run_as_console("C:\Windows\System32\PING.EXE",false,"")+"<br>");
    
    sleep(2);
    
    # 2 
    echo("\n2.       : \n");
    echo(app.run_as_console("C:\Windows\System32\PING.EXE",true,"")+"<br>");
    
    sleep(2);
    
    # 3 
    echo("\n3.       : \n");
    echo(app.run_as_console("C:\Windows\System32\PING.EXE",true,"ya.ru")+"<br>");
    
    # 
    echo("<hr><br>")
    
    # Quit
    app.quit()
    #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 = Environment.GetEnvironmentVariable("RPABOT_HOST_URL");
    			InitXHE();
    
    			// 
    			echo("<hr><font color=blue>app.run_as_php</font><hr>");
    
    			// 1 
    			echo("1.       : \n");
    			echo(app.run_as_console(@"C:\Windows\System32\PING.EXE",false,"")+"<br>");
    
    			sleep(2);
    
    			// 2 
    			echo("\n2.       : \n");
    			echo(app.run_as_console(@"C:\Windows\System32\PING.EXE",true,"")+"<br>");
    
    			// 3 
    			echo("\n3.       : \n");
    			echo(app.run_as_console(@"C:\Windows\System32\PING.EXE",true,"ya.ru")+"<br>");
    
    			// 
    			echo("\n\n");
    
    			app.quit();            
    	  }
    }
    //   ,    
    xhe_host="127.0.0.1:7023";
    echo=require("../../../Templates JS/init.js");
    
    // 
    echo("<hr><font color=blue>app.run_as_php</font><hr>");
    
    // 1 
    echo("1.       : ");
    echo(app.run_as_console('C:/Windows/System32/PING.EXE',false)+"<br>");
    
    // 2 
    echo("\n2.       : ");
    echo(app.run_as_console('C:/Windows/System32/PING.EXE',true)+"<br>");
    
    // 3 
    echo("\n3.     c  : ");
    echo(app.run_as_console('C:/Windows/System32/PING.EXE',true,"ya.ru")+"<br>");
    
    // 
    echo("\n");
    
    // Quit
    app.quit();

    =============================================
    App        DOM  System  Vision  Web  Window        
    =============================================
    - ,
    .