LLPlayer Object

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

The LLPlayer object simulates pressing and releasing of mouse buttons, rotations of mouse wheels and pressing and releasing of keyboard keys from your scripts. The object methods let you perform the same operations that you can perform with a low-level procedure. The only difference is that a low-level procedure typically executes a sequence of mouse clicks or key presses, while LLPlayer can execute only one of these operations at a time.

When you export a low-level procedure to a script, TestComplete converts all low-level events into a sequence of calls to LLPlayer methods. Once you have the script code generated in such a manner, you can modify parameters of the LLPlayer methods making low-level event parameters dependent on a variable or constant. In other words, exporting a low-level procedure to a script and subsequent modification of method parameters let you parameterize your low-level procedures. For more information on this, see Parameterizing Low-Level Procedures.

Members

Example

The following script uses the LLPlayer object methods to simulate multiple selection with a Shift-click.

JavaScript, JScript

function LLPMouseMoveExample()
{
  // Specifies the coordinates of the first click
  var coordX = 15;
  var coordY = 120;

  // Specifies a delay in milliseconds
  var sDelay = 2000; // 2 seconds

  // Simulates pressing and releasing the left mouse button
  LLPlayer.MouseDown(MK_LBUTTON, coordX, coordY, sDelay);
  LLPlayer.MouseUp(MK_LBUTTON, coordX, coordY, sDelay);

  // Simulates pressing the Shift key
  LLPlayer.KeyDown(VK_SHIFT, sDelay);

  // Specifies the coordinates of the destination point
  var destX = 98;
  var destY = 275;

  // Simulates mouse movement
  LLPlayer.MouseMove(destX, destY, sDelay);

  // Simulates pressing and releasing the left mouse button
  LLPlayer.MouseDown(MK_LBUTTON, destX, destY, sDelay);
  LLPlayer.MouseUp(MK_LBUTTON, destX, destY, sDelay);

  // Simulates releasing the Shift key
  LLPlayer.KeyUp(VK_SHIFT, sDelay);
}

Python

def LLPMouseMoveExample():
  # Specifies the coordinates of the first click
  coorX = 15
  coorY = 120
  # Specifies a delay in milliseconds
  sDelay = 2000
  # 2 seconds
  # Simulates pressing and releasing the left mouse button
  LLPlayer.MouseDown(MK_LBUTTON, coorX, coorY, sDelay)
  LLPlayer.MouseUp(MK_LBUTTON, coorX, coorY, sDelay)
  # Simulates pressing the Shift key
  LLPlayer.KeyDown(VK_SHIFT, sDelay)
  # Specifies the coordinates of the destination point
  destX = 98
  destY = 275
  # Simulates mouse movement
  LLPlayer.MouseMove(destX, destY, sDelay)
  # Simulates pressing and releasing the left mouse button
  LLPlayer.MouseDown(MK_LBUTTON, destX, destY, sDelay)
  LLPlayer.MouseUp(MK_LBUTTON, destX, destY, sDelay)
  # Simulates releasing the Shift key
  LLPlayer.KeyUp(VK_SHIFT, sDelay)

VBScript

Sub LLPMouseMoveExample()

  ' Specifies the coordinates of the first click
  coordX = 15
  coordY = 120

  ' Specifies a delay in milliseconds
  sDelay = 2000 ' 2 seconds

  ' Simulates pressing and releasing the left mouse button
  Call LLPlayer.MouseDown(MK_LBUTTON, coordX, coordY, sDelay)
  Call LLPlayer.MouseUp(MK_LBUTTON, coordX, coordY, sDelay)

  ' Simulates pressing the Shift key
  Call LLPlayer.KeyDown(VK_SHIFT, sDelay)

  ' Specifies the coordinates of the destination point
  destX = 98
  destY = 275

  ' Simulates mouse movement
  Call LLPlayer.MouseMove(destX, destY, sDelay)

  ' Simulates pressing and releasing the left mouse button
  Call LLPlayer.MouseDown(MK_LBUTTON, destX, destY, sDelay)
  Call LLPlayer.MouseUp(MK_LBUTTON, destX, destY, sDelay)

  ' Simulates releasing the Shift key
  Call LLPlayer.KeyUp(VK_SHIFT, sDelay)

End Sub

DelphiScript

function LLPMouseMoveExample;
var coordX, coordY, sDelay, destX, destY;
begin

  // Specifies the coordinates of the first click
  coordX := 15;
  coordY := 120;

  // Specifies a delay in milliseconds
  sDelay := 2000; // 2 seconds

  // Simulates pressing and releasing the left mouse button
  LLPlayer.MouseDown(MK_LBUTTON, coordX, coordY, sDelay);
  LLPlayer.MouseUp(MK_LBUTTON, coordX, coordY, sDelay);

  // Simulates pressing the Shift key
  LLPlayer.KeyDown(VK_SHIFT, sDelay);

  // Specifies the coordinates of the destination point
  destX := 98;
  destY := 275;

  // Simulates mouse movement
  LLPlayer.MouseMove(destX, destY, sDelay);

  // Simulates pressing and releasing the left mouse button
  LLPlayer.MouseDown(MK_LBUTTON, destX, destY, sDelay);
  LLPlayer.MouseUp(MK_LBUTTON, destX, destY, sDelay);

  // Simulates releasing the Shift key
  LLPlayer.KeyUp(VK_SHIFT, sDelay);

end;

C++Script, C#Script

function LLPMouseMoveExample()
{
  // Specifies the coordinates of the first click
  var coordX = 15;
  var coordY = 120;

  // Specifies a delay in milliseconds
  var sDelay = 2000; // 2 seconds

  // Simulates pressing and releasing the left mouse button
  LLPlayer["MouseDown"](MK_LBUTTON, coordX, coordY, sDelay);
  LLPlayer["MouseUp"](MK_LBUTTON, coordX, coordY, sDelay);

  // Simulates pressing the Shift key
  LLPlayer["KeyDown"](VK_SHIFT, sDelay);

  // Specifies the coordinates of the destination point
  var destX = 98;
  var destY = 275;

  // Simulates mouse movement
  LLPlayer["MouseMove"](destX, destY, sDelay);

  // Simulates pressing and releasing the left mouse button
  LLPlayer["MouseDown"](MK_LBUTTON, destX, destY, sDelay);
  LLPlayer["MouseUp"](MK_LBUTTON, destX, destY, sDelay);

  // Simulates releasing the Shift key
  LLPlayer["KeyUp"](VK_SHIFT, sDelay);
}

See Also

Testing Applications in Low-Level Mode
Parameterizing Low-Level Procedures
Running Low-Level Procedures
Low-Level Procedure Events
LowLevelProcedure Object

Highlight search results