![]() ![]() In my example I instead save X and Y to the third dimension of aoi_corners. In this case click 1 X and Y will be in positions 1 and 2, but click 2 X and Y will be in positions 2 and 3, so the Y from the first click will be overwritten by the X from the second click, etc. Another thing I noticed, which wasn't in your original question, is that on each click you're iterating the click variable by 1, but you're saving the X and Y position to click, and click 1. If you instead use GetMouse, but also wait until the button has been released before moving on, I think you'll get the behavior you want. But for example holding a key as you click the mouse will break out of the loop. The issue with GetClicks is that the keyboard is not being checked while waiting for the click, as you noted. My question is then is how do I get around this? Have I missed something obvious/written my code badly? Using getmouse on the other hand, allows KbCheck to work but takes the x,y coordinates from the point of the button getting pressed down, so it returns loads of values I don't need, even if I press and release the button as fast as I can. However it stops KbCheck from working (my searches tell me this is because it operates like KbCheck and pauses the program while it waits for more clicks?). The problem is essentially that, if I use getclicks to get the x,y coordinates I can get good x,y coordinates for the dot in my aoi_corners matrix as it takes the x,y at the point of button release. While ~KbCheck %check keyboard has not been pressed Screen('Preference', 'SkipSyncTests', 2) This is the code I have for this program: clear all Finally, the program should exit when a keyboard press is detected. Store the x,y location of the this click and all subsequent clicks in a single array.ģ. My program needs to do the following things:Ģ. Mouse mouse = ((HasInputDevices) driver).I'm trying to get the x,y coordinates of a click using Psychtoolbox on Matlab. Import .internal.Coordinates įinal Point image = page.findImage("C:\\Pictures\\marker.png") The solution is implementing anonymous class in this manner: import These are the coordinates that you most frequently want, since that is the coordinate system in which the document is defined. Document Coordinates: These are coordinates measured from the top left corner of the HTML Document. In all browsers these are in event.clientX and event.clientY. ![]() If the window is scrolled, vertically or horizontally, this will be different from the top left corner of the document. Window Coordinates: These are coordinates measured from the top left corner of the browser's content area. In all browsers these are in event.screenX and event.screenY. ![]() About the only time you'd want these coordinates is if you want to position a newly created browser window at the point where the user clicked. ![]() You'd rarely get coordinates (0,0) because that is usually outside the browser window. Screen Coordinates: These are coordinates measured from the top left corner of the user's computer screen. Webdriver provide document coordinates, where as Robot class is based on Screen coordinates, so I have added 120 to compensate the browser header. Robot.mouseMove(coordinates.getX(),coordinates.getY() 120) Zompocolypse(LolRektSoFast) January 7, 2022, 9:37pm 3 Sorry, I meant to provide my script. Still if you want to move the mouse pointer physically, you need to take different approach using Robot class Point coordinates = driver.findElement(By.id("ctl00_portalmaster_txtUserName")).getLocation() To get the mouse you can do: local mouse :GetMouse() For the position you can do: mouse.X or mouse.Y mouse.x/y will give you your mouse position. IMHO you should pay your attention to Robot.class ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |