User Tools

Site Tools


Sidebar

en:objects:mouse:send_events:send_move

send_move

send_move($x,$y,$scroll=true,$time=0,$tremble=5,$buttons=""); - this function is used to transmit mouse movement to a specified point in the browser, even if the program is hidden in the tray.

the input Function accepts parameters:br>
  • $x – the x coordinate of the point to which you need to pass mouse movement, relative to the upper left corner of the browser. (int)
  • $y – y - coordinate of the point to move the mouse to, relative to the upper-left corner of the browser. (int)
  • $scroll – whether to scroll the browser to the specified point. If false is simply passed permashine to a given point, And true, you will be automatically scrolling to the desired point (boolean).
  • $time – the time it takes to move from the current point (parameter is available from 4.6.16). (int)
  • $tremble – the amplitude of the trajectory jitter (for more human-like emulation) (parameter is available from 4.6.48). (int)
  • $buttons - a string with a set of buttons (more than one button can be held down) that will stay pressed when moving (available from 4.9.32) :
    • MK_CONTROL - Ctrl on the keyboard
    • MK_LBUTTON - left mouse button
    • mk_mbutton - middle mouse button
    • mk_rbutton - parvaya mouse button
    • mk_shift - shift on the keyboard
    • mk_xbutton1 - mouse button x1
    • mk_xbutton2 - mouse cap X2
    After testing, the function returns the result of its work to the script :
  • true – successfully moved to the specified point (boolean)
  • false – operation failed (boolean)

    PHP example:

    <?php $xhe_host = "127.0.0.1:7013";
     
    //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> mouse->".basename(__FILE__)."</font> <hr>";
     
    //1
    echo "1.Let's go to Google:";
    echo $browser->navigate("http://www.google.ru")."<br>";
    //$browser->set_zoom(200);
     
     
    //2
    echo "2.Move the mouse over the link:";
    $x = $anchor->get_x_by_inner_text("Advert", false);
    $y = $anchor->get_y_by_inner_text("Advert", false);
    echo $x."".$y."".$mouse->send_move($x + 3, $y + 3)."<br>";
    sleep(5);
     
    //3
    echo "3.Go to bigfozzy.com:";
    echo $browser->navigate("http://www.bigfozzy.com")."<br>";
     
    //4
    echo "4.Move the mouse over two links:";
    $x = $anchor->get_x_by_number(100); $y = $anchor->get_y_by_number(100);
    echo "$x $y".$mouse->send_move($x + 1, $y + 1, true, 2)."";
    sleep(5);
    $x = $anchor->get_x_by_number(120); $y = $anchor->get_y_by_number(120);
    echo "$x $y".$mouse->send_move($x + 1, $y + 1, true, 2)."<br>";
    sleep(5);
     
     
    //five
    echo "5.Let's check the work with JS:";
    $browser->run_java_script("
    var cursorX;
    var cursorY;
    document.onmousemove = function(e) {
        cursorX = e.pageX;
        cursorY = e.pageY;
    }
    setTimeout(checkCursor, 1000);
    function checkCursor()
    {alert('Cursor at:' + cursorX + ',' + cursorY); } ");
    $mouse->send_move(100,100);
     
    //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> mouse.xxxxxxxxx </font> <hr>")
     
    # 1
    echo("1.Let's go to google:")
    echo(browser.navigate("http://www.google.ru"), "<br>")
    browser.set_zoom(200)
     
     
    # 2
    echo("2.Move the mouse to the 'I'm lucky' button:")
    x = button.get_x_by_name("btnI")
    y = button.get_y_by_name("btnI")
    echo(x, "")
    echo(y, "")
    echo(mouse.send_move(x + 3, y + 3), "<br>")
    sleep(2)
     
    # 3
    echo("3.Go to bigfozzy.com:")
    echo(browser.navigate("http://www.bigfozzy.com"), "<br>")
     
    # 4
    echo("4.Move the mouse over two links:")
    x = anchor.get_x_by_number(101)
    y = anchor.get_y_by_number(101)
    echo(str(x) + "" + str(y) + "" + str(mouse.send_move(x + 1, y + 1, true, 2)), "")
    x = anchor.get_x_by_number(121)
    y = anchor.get_y_by_number(121)
    echo(str(x) + "" + str(y) + "" + str(mouse.send_move(x + 1, y + 1, true, 2)), "<br>")
     
     
    # five
    echo("5.Let's check the work with JS:")
    echo(browser.run_java_script("\ u000Avar cursorX) \ u000Avar cursorY) \ u000Adocument.onmousemove = function(e) {\ u000A cursorX = e.pageX) \ u000A cursorY = e.pageY) \ u000A} \ u000AsetTimeout(checkCursor, 1000 )) \ u000Afunction checkCursor() \ u000A {alert('Cursor at:' + cursorX + ',' + cursorY))} ")," ")
    echo(mouse.send_move(100,100))
    # 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:7010";
    InitXHE();
     
    //Start
    echo("<hr> <font color = blue> mouse.send_move </font> <hr>");
     
    //1 step
    echo("1.Let's go to Google:");
    echo(browser.navigate("http://www.google.ru") + "<br>");
     
    //pause
    sleep(3);
     
    //step 2
    echo("2.Move the mouse to the 'I'm lucky' button:");
    int x = btn.get_x_by_inner_text("I'm lucky!");
    int y = btn.get_y_by_inner_text("I'm lucky!");
    echo(mouse.send_move(x + 1, y + 1) + "<br>");
     
    //step 3
    echo("3.Move the mouse to 350 350 in 5 seconds:");
    echo(mouse.send_move(x + 1, y + 1, false, 5));
     
    //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:7010";
    echo = require("../../../Templates JS/xweb_human_emulator.js");
     
    //Start
    echo("<hr> <font color = blue> mouse.send_move </font> <hr>");
     
    //1 step
    echo("1.Let's go to Google:");
    echo(browser.navigate("http://www.google.ru") + "<br>");
     
    //step 2
    echo("2.Move the mouse to the 'I'm lucky' button:");
    x = button.get_x_by_name("btnI");
    y = button.get_y_by_name("btnI");
    echo(x + "" + y + "" + mouse.send_move(x + 3, y + 3) + "<br>");
    browser.sleep(2);
     
    //step 3
    echo("3.Let's go to bigfozzy.com:");
    echo(browser.navigate("http://www.bigfozzy.com") + "<br>");
     
    //step 4
    echo("4.Move the mouse over two links:");
    x = anchor.get_x_by_number(100); y = anchor.get_y_by_number(100);
    echo(x + "" + y + "" + mouse.send_move(x + 1, y + 1, true, 4) + "");
    x = anchor.get_x_by_number(120); y = anchor.get_y_by_number(120);
    echo(x + "" + y + "" + mouse.send_move(x + 1, y + 1, true, 4) + "<br>");
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();
  • en/objects/mouse/send_events/send_move.txt · Last modified: 2026/08/05 22:46 (external edit)