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

screenshot

screenshot($path,$x=-1,$y=-1,$width=-1,$height=-1,$as_gray=false,$screen=0); -

:

  • $path
  • $x X- (-1 , 0)
  • $y Y- (-1 , 0)
  • $width (-1 )
  • $height (-1 )
  • $as_gray
  • $screen

    :
  • true
  • false

    <?php
    // Scenario: Take screenshots of the desktop or specific regions
    $xhe_host = getenv("RPABOT_HOST_URL");
    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);
    }
    
    // Step: Start the script
    echo "\n";
    
    // Example 1: Screenshot of entire desktop (monitor 1)
    $filePath1 = "test/all0.jpg";
    echo "Screenshot of entire desktop (monitor 1): ";
    $result1 = WINDOW::$windows->screenshot($filePath1);
    echo $result1 . "\n";
    WINDOW::$app->shell_execute("open", "test/all0.jpg");
    
    // Example 2: Screenshot of entire desktop (monitor 2) - simplified
    $filePath2 = "test/all1.jpg";
    $monitor2 = 1;
    $simplified = true;
    echo "\nScreenshot of entire desktop (monitor 2) - simplified: ";
    $result2 = WINDOW::$windows->screenshot($filePath2, -1, -1, -1, -1, $simplified, $monitor2);
    echo $result2 . "\n";
    WINDOW::$app->shell_execute("open", "test/all1.jpg");
    
    // Example 3: Screenshot of part of desktop (monitor 1)
    $filePath3 = "test/part0.jpg";
    $x = 100;
    $y = 100;
    $width = 100;
    $height = 100;
    echo "\nScreenshot of part of desktop (monitor 1): ";
    $result3 = WINDOW::$windows->screenshot($filePath3, $x, $y, $width, $height);
    echo $result3 . "\n";
    WINDOW::$app->shell_execute("open", "test/part0.jpg");
    
    // 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:7070"
    from xweb_human_emulator import *
    
    # 
    echo("<hr><font color=blue>windows.xxxxxxxxx</font><hr>")
    
    # 1 
    echo("1.    (1 ) : ");
    echo(windows.screenshot("test\\all0.jpg"),"\n");
    app.shell_execute("open","test\\all0.jpg");
    
    # 2
    echo("2.    (2 ) -  : ");
    echo(windows.screenshot("test\\all1.jpg",-1,-1,-1,-1,true,1),"\n");
    app.shell_execute("open","test\\all1.jpg");
    
    # 3
    echo("3.    (1 ) : ");
    echo(windows.screenshot("test\\part0.jpg",100,100,100,100),"\n");
    app.shell_execute("open","test\\part0.jpg");
    
    # 
    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>windows.get_cpu_name</font><hr>");
    
    			// 1 
    			echo("1.    (1 ) : ");
    			echo(windows.screenshot("test\\all0.jpg")+"\n");
    			app.shell_execute("open","test\\all0.jpg");
    
    			// 2
    			echo("2.    (2 ) -  : ");
    			echo(windows.screenshot("test\\all1.jpg",-1,-1,-1,-1,true,1)+"\n");
    			app.shell_execute("open","test\\all1.jpg");
    
    			// 3
    			echo("3.    (1 ) : ");
    			echo(windows.screenshot("test\\part0.jpg",100,100,100,100)+"\n");
    			app.shell_execute("open","test\\part0.jpg");
    
    			// 
    			echo("\n\n");
    
    			app.quit();            
    	  }
    }
    //   ,    
    xhe_host="127.0.0.1:7070";
    echo=require("../../../Templates JS/init.js");
    
    // 
    echo("<hr><font color=blue>windows.get_user_name</font><hr>");
    
    // 1 
    echo("1.    (1 ) : ");
    echo(windows.screenshot("test\\all0.jpg")+"\n");
    app.shell_execute("open","test\\all0.jpg");
    
    // 2
    echo("2.    (2 ) -  : ");
    echo(windows.screenshot("test\\all1.jpg",-1,-1,-1,-1,true,1)+"\n");
    app.shell_execute("open","test\\all1.jpg");
    
    // 3
    echo("3.    (1 ) : ");
    echo(windows.screenshot("test\\part0.jpg",100,100,100,100)+"\n");
    app.shell_execute("open","test\\part0.jpg");
    
    // 
    echo("\n");
    
    // Quit
    app.quit();

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