Youmight want to expand on what an autoclicker is and what it does as it is not a device I've heard of before. A quick google search suggests it maybe an electronic version of a metronome - i.e. a device that produces a click or other sound at regular intervals.
The problem with repurposing parts of a device is that the original manufacturer likely won't detail the signals/connections, as it's not something that is required in order to operate the device. The intention being that the user just plugs it into the controller and uses it.
I think it simulates a finger-click on a smartphone/tablet touch screen. People use them to build up large numbers of fake "likes" for themselves on social media, to impress their friends and boost their egos. The clicker has a suction cup allowing it to be stuck on just the right point on the screen.
I suspect they'll contain a small solenoid-like device, so will need a higher current than an Arduino pin can source, so some transistors will be required, and flyback diodes will be needed to protect the Arduino.
You could start with verifying how many wires there are in that cable, then measure the voltage that original machine outputs when "clicking". If it's just a analog 2 wire device, after that you could try to simulate that pulse.
This depends a bit on the kind of application you are writing, but if you can, I would watch the cursor movement, not the clicks.Human mouse movement has non-uniform speeds, reaction times, imprecisions (clicks on different coordinates of your buttons, etc...).
Also, you can defend a gui against bots by randomly requiring an interaction that is hard to script. For example: If scripts depend upon buttons being always in the same position, I would make sure that, while trying to remain intuitive, the dialog should pop up in slightly different positions every time.
Otherwise: There is no way to detect if the mouse is a real one or a really well simulated one. The Windows HID/MacOS/Linux driver layer abstracts away the distinction between Mice, TrackPens, TrackBalls, draw-pads, touch screens... and of course script-mice...
Although the blog post itself is about a different issue, I refer you to Raymond Chen's excellent Old New Thing. In this specific blog post he talks about the validity of message parameters going into an application, but also makes the point that:
There's no point discussing the possibility that the sender of the message is playing tricks and lying to you because (1) your program should just go along with the ruse and respond to fake menu messages as if they were real menu messages, because (2) there's no way to tell that you're being lied to anyway. To detect lying, you'd have to be able to read into the mindset of the programmer who sent you the message.
Is mouse keys simulated mouse input or legit? The point of simulating mouse input is to make them look exactly like real mouse input. If the simulation is doing its job, then your job is impossible. Sorry, that's the blessing & curse of software for you. Here are some more imperfect ideas:
I've used WIN32API calls to read pixels/manipulate the mouse/send keystrokes to automate large portions of video games and other repetitive tasks. You could write a lot of code to analyze the input, but equally smart developers are just going to modify their code to match.
When I first try to automate a mouse click, that's all I'll do. Send a mouse click. And most of the time it works. You might have code that tracks the mouse movement and the entire stack of mouse events that would fire along with a legitimate click and say, 'That wasn't real - we ignore it' but nothing stops the developer from also implementing mouse movements.
The mouse events are more complex than keypresses; but it's essentially the same idea. If you write code that monitors the time between keypresses and determine that I'm sending the '2' key to your application in EXACTLY 250ms intervals, you might decide I'm a bot. But, all I'll do is modify my code to send the keystroke in 250ms + a random value between -25 and 25 ms.
Events can be sent directly to controls without moving the mouse so find out where the mouse is when you get the click event and see if it's on the control. Keyboard input requires control focus, so check that too.
For situations where the mouse moves, you won't be able to tell if the mouse movement is recorded and played back. If its scripted then perhaps you could monitor the mouse behavior in the parent panel(s) of the control and use those events and movements to ascertain whether it is real or not. An automated click might appear from nowhere and cause an flurry of unlikely hover, focus events.
With the WinAPI you can send a message to any window in order to simulate, for example, a WM_LBUTTONDOWN event. In this message you would include the X and Y location of the mouse at the time the button was pressed - or where the receiving program expects it to be. When you handle the message you could use the GetCursorPos call to get the actual cursor position. Verify that the current position is close to that in the message, and handle it as a click, otherwise ignore it.
This solution would only work if the "click" is generated by a simple Send/PostMessage. If the application that is generating the click simulates the movement of the mouse also, then you should probably see the other answers :)
I'm not sure there is a way to determine with perfect accuracy whether a mouse click is automated or not. I mean, you could write your own USB driver that sits in between the native mouse driver and the OS and relays only "real" clicks to you. However, even that can be defeated by plugging in a USB device (like a smartphone) that's programmed to send USB packets to host computer.
Create a statistical learning solution by logging the past X mouse events in your program. When the user clicks on the control, determine the probability based on the last X actions that it's a real click.
It is much more harder than what you think because input macro programs produce legit mouse and keyboard input messages to your game. I don't think there is a way to check if the input message is actually triggered by a physical hardware input (like mouse or keyboard) unless OS provides you with accessibility of input-driver-level.
Use outside monitoring tools to inspect all processes running in a machine to find out programs known for cheating purpose. Steam does this. Check Valve Anti-Cheat System Blizzard's WoW also does the same thing with Warden.
My own advice would be "Use your gameplay system". Since every game has its own rules and gameplay styles, it wouldn't be too hard to detect whether a player is cheating or not. This approach won't be a general solution and it could be silly but if it works for your game, why not? :)
I have been experimenting with ways to make something click for a very long period of time so I can let a game run without me having to do anything and I so far have not found something so I would like to ask for some help from the community.
Thank you for using Apple Support Communities. It sounds like you'd like to know if it's possible to create an auto clicker or have something click for a specific period of time without you touching your device. Allow us to assist in any way we can. We also notice that you're already coming from a helpful resource below:
Depending on your iPadOS version, you can create specific gestures that allow you to auto click. However, it won't be for a very long period of time. You apply a loop to your gesture, and it will loop up to 10 times. If you're on iPadOS 14, you can go to Settings > Accessibility > Switch Control. Select Switches > Add New Switch > Screen > Full Screen > Select Item. Once you've done this, go back to Accessibility > Recipes > Create New Recipe > Name your recipe then select the Switch you had created, followed by custom gesture. This option will allow you to tap on your display "click" the number of clicks you want.
Just be sure that "Launch Recipe" is showing the auto-clicker gesture you had created. While in your game, you should be able to triple-click your Home button to launch the gesture you created. Just remember, it's not for a very long period of time, just loops up to 10 times. Just in case, here is another resource below:
I use i3WM and when i first start the computer (from off) I log into the desktop and the mouse can move across the screen but i cannot click anything. The keyboard works fine. I am forced to restart so that the mouse can click. After a restart, everything works fine.
For example, when i start i3 i have two apps autostart: email (geary) and web browser. I can move the mouse around freely but cannot click on any email or any link in the browser (left or right click). Keyboard works perfectly fine. Sometimes, not all the time, it looks like the mouse is off by a couple hundred pixels. Like i can see it highlight an email when my mouse is on the other side of the screen. Try as i might (and i've pretty much clicked the whole screen) I still cannot get it to click on any email.
3a8082e126