mouse

javascript simulate mouse click on specific position

微笑、不失礼 提交于 2019-12-10 10:06:05
问题 I need to now how to fire a mouse click event on a button automatically. I have this but doesn't work :( window.setInterval(function() { simulateClick(); }, 2000); function simulateClick() { var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", false, false, window, 0, 684, 571, 684, 508, false, false, false, false, 0, null); var a; a.dispatchEvent(evt); } Thanks in advance Oscar 回答1: If all you want to do is click a button, button elements have a click method that can be

Is there a simple way to detect mouse or keyboard activity in Linux/Xorg/Qt4/Kde4?

左心房为你撑大大i 提交于 2019-12-10 06:15:10
问题 Is there a simple way to detect mouse or keyboard activity in Linux or Xorg or Qt4 or Kde4 environment? Obviously not only on a particular window but in the entire Xorg desktop. 回答1: You can use the XScreenSaver extension ( man Xss ). It can provide you with values into this struct using the function XScreenSaverQueryInfo : typedef struct { Window window; /∗ screen saver window */ int state; /∗ ScreenSaver{Off,On,Disabled} */ int kind; /∗ ScreenSaver{Blanked,Internal,External} */ unsigned

Control the mouse and keyboard Golang?

浪子不回头ぞ 提交于 2019-12-10 02:30:39
问题 How would one go about controlling retrieving/setting the position of the mouse and triggier keyboard events on the operating system/X11 level? This is similar to functionality found in the Robot class in Java. I understand there will most likely not be a cross platform solution, but how would one go about implementing this on Windows, Linux and Mac? 回答1: Please see robotgo, Golang Native cross-platform system automation 回答2: There are lots of ways to tackle this. The project that appears

Snap to grid mouse locking up

删除回忆录丶 提交于 2019-12-09 21:09:53
问题 I am working on an application which draws a simple dot grid. I would like the mouse to snap between the points on the grid, eventually to draw lines on the grid. I have a method which takes in the current mouse location (X,Y) and calculates the nearest grid coordinate. When I create an event and attempt to move the mouse to the new coordinate the whole system becomes jerky. The mouse doesn't snap smoothly between grid points. I have copied a code sample below to illustrate what I am

jQueryUI autocomplete 'select' does not work on mouse click but works on key events

故事扮演 提交于 2019-12-09 13:17:34
问题 JS/JQuery: $this.find('input').autocomplete({ source: "/autocomplete_tc_testcasename", minLength: 2, focus: function(e,ui){ $(this).val(ui.item.label); return false; }, select: function(e, ui) { console.log("Selected: "+ui.item.value); } }); CSS: .ui-autocomplete { max-height: 200px; overflow-y: auto; padding: 5px; } .ui-menu { list-style: none; background-color: #FFFFEE; width: 50%; padding: 0px; border-bottom: 1px solid #DDDDDD; border-radius: 6px; -webkit-box-shadow: 0 8px 6px -6px black;

ActionScript - Inaccurate Mouse Coordinates?

╄→尐↘猪︶ㄣ 提交于 2019-12-09 12:58:16
问题 when tracing the mouseX / mouseY or localX / localY coordinates of a display object, why does x start at 1 while y starts at 0? for example, i've drawn a simple 400 x 400 pixel sprite onto the stage with a MouseEvent.MOUSE_MOVE event listener that calls a handler function to trace the local coordinates of the mouse. the first, top-left pixel returns {x:1, y:0} and the last, bottom-right pixel returns {x:400, y:399} . shouldn't both the x and y start and end with the same value? i'm not sure

Tkinter see through window not affected by mouse clicks

我是研究僧i 提交于 2019-12-09 03:31:01
问题 I am currently controlling a game with python by sending mouse and keystroke commands. What I am looking to do is have a transparent Tkinter window lay overtop of the game to provide some information such as mouse location and pixel color. I am familiar with changing the window's alpha attribute to make it transparent but have no idea how to always keep that window in front and have mouse clicks pass through it. My current method of controlling the game involves taking screenshots in certain

Windows 7 becomes unresponsive if mouse scroll wheel is used after a simulation in R

不羁的心 提交于 2019-12-08 21:40:30
问题 I am using R 3.0.2 in Windows 7 64 bit. After running simulations with an output greater than about 100000 in length, if I use the mouse scroll wheel in the R console, Windows freezes indefinitely. I once left it sitting for over a week with no response. Forcing shutdown is the only way out, and it does not register in Windows event log. I have tried to duplicate the issue in other programs, but it appears to occur only in R. I have tried several versions of R, uninstalled and reinstalled

How to simulate mouse click?

本秂侑毒 提交于 2019-12-08 19:59:20
问题 I'm trying to make a program to click with keyboard like in Osu!. I've tried SendKeys() , RaiseMouseEvent() and OnMouseClick() . Now I'm trying this and can't get anything to work. The error I keep getting is: PInvoke restriction: cannot return variants. Public Class Form1 Dim onn As Boolean = False Declare Function mc Lib "user32.dll" Alias "mouse_event" (flag, x, y, button, extra) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If

Did user use keyboard or mouse to leave WPF TextBox?

☆樱花仙子☆ 提交于 2019-12-08 19:30:20
问题 I have a handler for the TextBox's PreviewLostKeyboardFocus event. It fires when I leave the TextBox using the keyboard (Tab key) or the mouse (by clicking on another TextBox on the form). The handler takes a KeyboardFocusChangedEventArgs , which has a property named KeyboardDevice , which isn't null in either scenario (I was hoping to find null here when using the mouse). Question: How can I tell whether a user used the keyboard or the mouse to leave a WPF TextBox? 回答1: The e.KeyboardDevice