Articles

[Collapse]TestComplete/viewarticle/63445/
 [Expand]General Information/viewarticle/63445/
 [Expand]Using Help System/viewarticle/55799/
 [Expand]Getting Started Tutorial/viewarticle/56246/
 [Expand]Using TestComplete/viewarticle/57875/
 [Expand]Testing Types/viewarticle/62721/
 [Expand]Applications Testing/viewarticle/62606/
 [Expand]Working With Application Objects and Controls/viewarticle/55815/
 [Expand]Samples and Tutorials/viewarticle/56239/
 [Collapse]References/viewarticle/57878/
  [Expand]Test Objects/viewarticle/57881/
  [Expand]Scripting Objects/viewarticle/57882/
  [Collapse]Project and Project Item Objects/viewarticle/57880/
   [Expand]Project Suite Objects/viewarticle/59766/
   [Collapse]Project Item Objects/viewarticle/59767/
     ActiveX Objects/viewarticle/56464/
    [Expand]Android Gesture Collection/viewarticle/59748/
    [Expand]Events/viewarticle/56945/
    [Expand]Image Repository/viewarticle/59749/
    [Expand]Keyword Testing/viewarticle/59771/
    [Collapse]Low-Level Procedures Collection/viewarticle/59772/
     [Expand]LLPlayer/viewarticle/56754/
     [Expand]LowLevelProcedure/viewarticle/55226/
    [Expand]Manual Tests/viewarticle/59773/
    [Expand]Name Mapping/viewarticle/59774/
    [Expand]Network Suite/viewarticle/59775/
    [Expand]ODT/viewarticle/59776/
    [Expand]Script/viewarticle/59777/
    [Expand]Stores/viewarticle/59778/
    [Expand]Tested Applications/viewarticle/59779/
    [Expand]Unit Testing/viewarticle/59780/
    [Expand]User Forms/viewarticle/59781/
    [Expand]Web Services/viewarticle/59782/
   [Expand]Project Objects/viewarticle/59768/
   [Expand]Test Log Objects/viewarticle/59769/
   [Expand]COM Automation Objects/viewarticle/59770/
  [Expand]TestComplete Events/viewarticle/56945/
  [Expand]Language Reference/viewarticle/57879/
  [Expand]User Form Components/viewarticle/56689/
 [Expand]Other Tools That Help You Test Better/viewarticle/63442/
 [Expand]TestComplete 10 Licensing Guide/viewarticle/63451/
Updated: 7/15/2014 Applies To: TestComplete 10 Rating: No votes Click to rate: PoorNot badAverageGoodExcellent
Programming Reference

LLPlayer Object

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.

VBScript

Sub 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
  Call LLPlayer.MouseDown(MK_LBUTTON, coorX, coorY, sDelay)
  Call LLPlayer.MouseUp(MK_LBUTTON, coorX, coorY, 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

JScript

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

  // Specifies a delay in milliseconds
  var 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
  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);
}

DelphiScript

function LLPMouseMoveExample;
var coorX, coorY, sDelay, destX, destY;
begin

  // 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);

end;

C++Script, C#Script

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

  // Specifies a delay in milliseconds
  var 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
  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 | Executing Low-Level Procedures | Low-Level Procedure Events | LowLevelProcedure Object


© 2014 SmartBear Software. All rights reserved.
Email Send feedback on this document