Mouse click repeat on mouse down

I’m wondering how to create an applescript that’ll repeat my left mouse button clicks when i hold down my left mouse button. And when i stop pushing down the button, it’ll stop repeating.

Does anyone know? Should be simple, but i can’t figure it out.

nobody?

This cannot be done with vanilla AppleScript however I’m not sure but you could take a look at the NSEvent class using AppleScriptObjC. In Objective-C this is possible so it should be possible using AppleScriptObjC. You can add an event monitor and respond to the mouse down event and then sending a mouse up and mouse down event again repeatedly until you receive the mouse up event again (this is how auto clicker software works). You can choose to monitor certain application events but also the global events.

Clicking is quite easy and there are a lot of tools for that but monitoring mouse event and responding to them is not that easy in AppleScript.

But only for mouse presses directed at the ASObjC app. I suspect the OP wants to deal with events sent to another app, which is more problematic.

Thanks, just what I was afraid for. So it’s the lower level API CoreGraphics that the TS will have to use indirectly then. CG can click and monitor process specific and global context, which I use in my scripting additions as well.

Yes,

I need this for another program. So this is hard to do? Howbout a keyboard key repeat? Is this more easy or does this not matter?

Yes, it’s the event taps stuff – I used it in ASObjC Runner.

Taking control of events that are meant for another application is difficult – and if you think about it, that’s probably not such a bad thing.