#How to click without moving mouse
46 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @short forum! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Doesn't look like it. But sounds like a good place to just create a pressAt function and use that instead. You already have the code written for it to work.
Ye, but I don't want to move the mouse which is the issue
If I may ask, why can't you move the mouse?
I am trying to create my own macro app, and this part is for an autoclicker. Because its a autoclicker then my keyboard focus goes off the app so I can't use keybinds to disable it, which only leaves using the mouse with a button, but because I want this to have a lot more features that won't always work if I want to move the mouse. Either I need to figure out how to have keyboard focus on multiple windows/apps, force it onto mine (I don't think this would be a good way to go around it), or make it so I press in a position on screen without actually moving my mouse to that position so I can freely move the mouse to the button on the JFrame where I stop the autoclicker
so anyway is my best bet just doing something like
int prevX = (int) MouseInfo.getPointerInfo().getLocation().getX();
int prevY = (int) MouseInfo.getPointerInfo().getLocation().getY();
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseMove(prevX, prevY)
even though that would be pretty scuffed? Atleast I would imagine it would be
So what will this auto clicker be doing?
Will it be just speed clicking, stopping afk timers, navigating through menus?
Because everything I have read so far has said to close a JFrame you need focus, and that you cannot click a certain set of coords without first moving your mouse to the location.
So understanding exactly what is wished to be done may help find a suitable solution
Well the final goal is to have click in different positions on the screen (done, but has issue said above), requirements for clicking such as color (done), time reqs, amount of times a certain thing would happen, etc, scrolling, and so on. Since it would be set up by the user inside the app, it's overall purpose for the final goal is just to automate anything that happens with the mouse and possibly keyboard presses as well if I decide to add it. I have an idea on how to program all of that, but im having issues on how to run it without potentially preventing the user from stopping the autoclicker because it takes keyboard focus off of the app and moves mouse, so if you don't have touch screen you can't really stop the auto-clicker. However it's done, The most basic form my issue I can think of is that I just need a way to stop the autoclicker without mouse or keyboard focus, or I figure out a way to grant the user that stuff while continuing to keep the autoclicker running
Just a reminder that any discussion of botting software is against Discord's ToS. However, to answer your question. If it's a Java application, you can use reflection to hook in to the swing or JavaFX callbacks.
If it's not a Java application, you'll have to use JNI to hook in to the applications mouse hooks and interact with it using C.
Either those mentioned above, or you'll just have to live with the fact that it'll move your mouse.
Oh, I thought itd be fine since when I was looking on the ToS I saw it specifically say to not cause harm such as through "auto-messaging, or auto-dialing people" and I wasn't planning to use this to hurt anyone or anything. If I assumed wrong then sorry
Any botting software in general
anyway ill look into those things, thank you
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
I'm assuming this is for a video game
Not entirely sure, the plan is kinda just to allow me to automate certain tasks that always stay the same but take time to do manually. It's also being used as experience for programming, as mostly ive just made stuff in Unity and I want to learn more langauges.
This could be an X/Y problem. What are you trying to automate? Perhaps you don't need to move the mouse at all.
As I said im not entirely sure. Might be games (although I would check whether or not that game allows macros first), might be traveling through certain menus on my computer, might use it for a game I make myself eventually, or I might end up not finding a use for it and just never opening it up. The only thing I know for a fact im using it for is to learn more about java, as i have never dealt with JFrames and such before
So just a general purpose macro program. Makes sense
yep
That's very broad, you can't have one application do everything on anything.
Software is tailored for a specific purpose, so if you want to automate an excel sheet, it'd be different than some other generic task.
Unless that's what you wanted, you want it to be able to do anything and everything.
In that case, you'd have to use the users mouse and keyboard.
No it's not supposed to do everything, just a general macro program for the mouse
In the scenario of something like excel or google sheets, pretty sure they have their own way of making programs so I would just use that
Okay well then you have 4 options for mouse inputs.
Use robot
Use native hooks
Hook in to it with reflection if it's a Java application
Or use something like
Which is just an abstraction of the native hooks
Nevermind that last option, it's only used for detecting native mouse events.
That repo has a keyboard listener thou? or does it say somewhere it doesn't work?
ok, I will look into all of that, thank you. Should I close this post now?
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
It's used for detecting mouse and keyboard events
Not for interacting with the mouse and or keyboard
Ah. I was thinking having this run to listen for a close program key to avoid the lockup and focus problems OP was having
but still have java robot handle all the automation
Thanks everyone who helped