Scan for mouse click?

Hi,

I am looking for a way to have my script pause until a click is detected. I actually am looking for more of a ‘keynote presentation’ sort of thing, I need a wireless device that can allow my script to go through it’s sections. I thought the easiest thing would be to use my apple bluetooth mouse, if I can just have applescript detect if a mouse click has happened… I don’t want to have to click on a dialog box, but to rather just be able to simply press a button regardless of where the mouse cursor is. Any suggestions?

Thanks.

Applescript does not offer a direct mechanism to intercept a mouse event.
But there is a workaround: install “Extra Suites” (Google for it) and try:


repeat 10000 times
	tell application "Extra Suites"
		if ES mouse down then my doAction()
	end tell
	do shell script "Sleep 0.2"
end repeat

on doAction()
	beep -- or whatever call you want to trigger
	do shell script "Sleep 2"
end doAction

However, this consumes a lot of CPU power, so there may be better solutions.