Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1005793 // mouseClick - simulate mouse click; TODO: use mouseMover()

JavaX fragment (include)

static int mouseClick_delay = 100; // how long to keep pressed

static void mouseClick(Rect r) {
  mouseClick(centerOfRect(r));
}

static void mouseClick(Pt p) {
  mouseClick(p.x, p.y);
}

static void mouseClick(int x, int y) ctex {
  final new Robot robot;
  robot.mouseMove(x, y);
  mouseClick();
}

static void mouseClick() ctex {
  final new Robot robot;
  final int button = InputEvent.BUTTON1_DOWN_MASK;
  robot.mousePress(button);
  sleep(mouseClick_delay);
  robot.mouseRelease(button);
}

Author comment

Began life as a copy of #1005571

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005793
Snippet name: mouseClick - simulate mouse click; TODO: use mouseMover()
Eternal ID of this version: #1005793/3
Text MD5: 04da43ddb94c11a7c2341d8d3764f70e
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-01 01:17:24
Source code size: 518 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 509 / 519
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1019908 - robot_leftMouseButtonPressOrRelease_scaled