Skip to content

Latest commit

 

History

History
336 lines (262 loc) · 11.3 KB

File metadata and controls

336 lines (262 loc) · 11.3 KB

WindowsLepik

WindowsLepik - A class that provides methods for windows machines.

Kind: global class

windowsLepik.getMousePosition() ⇒ Promise.<{x: number, y: number}>

Gets the current position of the mouse cursor on the screen.

Kind: instance method of WindowsLepik
Returns: Promise.<{x: number, y: number}> - A Promise that resolves with an object containing the X and Y coordinates of the mouse cursor.
Example

const lepik = require("lepikjs");
lepik.getMousePosition().then(position => {
  console.log(`Mouse position: X = ${position.x}, Y = ${position.y}`);
});

windowsLepik.mouseClick([button], [amount])

Performs a click with the specified mouse button.

Kind: instance method of WindowsLepik

Param Type Default Description
[button] string | number "'left'" The button to use for the click (left, right, or middle mouse button).
[amount] number 1 The number of clicks to perform. Default value is 1.

Example

const lepik = require("lepikjs");
lepik.mouseClick("right", 2);

windowsLepik.mouseDoubleClick([button])

Performs a double-click with the specified mouse button.

Kind: instance method of WindowsLepik

Param Type Default Description
[button] string | number "'left'" The button to use for the click (left, right, or middle mouse button).

Example

const lepik = require("lepikjs");
lepik.mouseDoubleClick("middle");

windowsLepik.mouseScroll([amount])

Scrolls the mouse wheel up or down by the given amount.

Kind: instance method of WindowsLepik

Param Type Default Description
[amount] number 0 The amount to scroll. A positive number scrolls up, a negative number scrolls down.

Example

const lepik = require("lepikjs");
lepik.mouseScroll(3);

windowsLepik.mouseDrag(fromX, fromY, toX, toY, [absolute])

Drag the mouse from the first coordinates to the second coordinates.

Kind: instance method of WindowsLepik

Param Type Default Description
fromX number The X-coordinate to start dragging from.
fromY number The Y-coordinate to start dragging from.
toX number The X-coordinate to drag to.
toY number The Y-coordinate to drag to.
[absolute] boolean false Whether or not to use an absolute positioning of the mouse.

Example

const lepik = require("lepikjs");
lepik.mouseDrag(100, 100, 200, 200);

windowsLepik.mouseMove(toX, toY, [absolute])

Move the mouse to the specified coordinates.

Kind: instance method of WindowsLepik

Param Type Default Description
toX number The X-coordinate to move to.
toY number The Y-coordinate to move to.
[absolute] boolean false Whether or not to use an absolute positioning of the mouse.

Example

const lepik = require("lepikjs");
lepik.mouseMove(500, 500);

windowsLepik.keyTap(key) ⇒ void

Sends a key tap event for the given key.

Kind: instance method of WindowsLepik

Param Type Description
key string The key to tap. Must be a single character or a key name from the list returned by the getSupportedKeys method.

Example

const lepik = require("lepikjs");
lepik.keyTap("a");

windowsLepik.write(text) ⇒ void

Sends a string of text to the active window by simulating individual key presses for each character.

Kind: instance method of WindowsLepik

Param Type Description
text string The text to write.

Example

const lepik = require("lepikjs");
lepik.write("Hello, World!");

windowsLepik.keyDown(key) ⇒ void

Sends a key down event for the given key.

Kind: instance method of WindowsLepik

Param Type Description
key string The key to press. Must be a single character or combination of keys.

Example

const lepik = require("lepikjs");
lepik.keyDown("Shift");

windowsLepik.keyUp(key) ⇒ void

Sends a key up event for the given key.

Kind: instance method of WindowsLepik

Param Type Description
key string The key to press. Must be a single character or combination of keys.

Example

const lepik = require("lepikjs");
lepik.keyUp("Shift");

windowsLepik.copy() ⇒ void

Copies the selected text or content.

Kind: instance method of WindowsLepik
Example

const lepik = require("lepikjs");
lepik.copy();

windowsLepik.paste() ⇒ void

Pastes the copied text or content.

Kind: instance method of WindowsLepik
Example

const lepik = require("lepikjs");
lepik.paste();

windowsLepik.getScreenSize() ⇒ Promise.<{width: number, height: number}>

Gets the screen size.

Kind: instance method of WindowsLepik
Returns: Promise.<{width: number, height: number}> - A Promise that resolves with an object containing the width and height of the screen.
Example

const lepik = require("lepikjs");
lepik.getScreenSize().then((size) => {
  console.log(`Screen size: Width = ${size.width}, Height = ${size.height}`);
});

windowsLepik.getActiveWindow() ⇒ Promise.<number>

Gets the ID of the active window.

Kind: instance method of WindowsLepik
Returns: Promise.<number> - A Promise that resolves with the ID of the active window.
Example

const lepik = require("lepikjs");
lepik.getActiveWindow().then((windowId) => {
  console.log(`Active window ID: ${windowId}`);
});

windowsLepik.setActiveWindow(windowHandle) ⇒ void

Sets the specified window as the active window.

Kind: instance method of WindowsLepik

Param Type Description
windowHandle string The handle of the window to set as active.

Example

const lepik = require("lepikjs");
lepik.setActiveWindow("window123");

windowsLepik.minimizeWindow(windowHandle) ⇒ void

Minimizes the specified window.

Kind: instance method of WindowsLepik

Param Type Description
windowHandle string The handle of the window to minimize.

Example

const lepik = require("lepikjs");
lepik.minimizeWindow("window123");

windowsLepik.maximizeWindow(windowHandle) ⇒ void

Maximizes the specified window.

Kind: instance method of WindowsLepik

Param Type Description
windowHandle string The handle of the window to maximize.

Example

const lepik = require("lepikjs");
lepik.maximizeWindow("window123");

windowsLepik.closeWindow(windowHandle) ⇒ void

Closes the specified window.

Kind: instance method of WindowsLepik

Param Type Description
windowHandle string The handle of the window to close.

Example

const lepik = require("lepikjs");
lepik.closeWindow("window123");

windowsLepik.getWindowTitle(windowHandle) ⇒ string

Returns window title of given window handle.

Kind: instance method of WindowsLepik

Param Type Description
windowHandle string The handle of the window to close.

Example

const lepik = require("lepikjs");
let title = await lepik.getWindowTitle("window123");

windowsLepik.delay(ms) ⇒ Promise.<void>

Delays the execution for the specified number of milliseconds.

Kind: instance method of WindowsLepik
Returns: Promise.<void> - A Promise that resolves after the delay.

Param Type Description
ms number The number of milliseconds to delay.