The Holy Grail of hiding the mouse cursor in OS X

This is perhaps a bit off the topic I’ve set for this page, but…

I recently ran into the most surprising problem, one which I couldn’t find a solution to anywhere on the internet. I needed to automatically hide the mouse cursor on an installation machine when it restarts.

The installation machine is running Flash content. So I simply tried using Mouse.hide(); as the movie starts. The problem with this is, that the code only functions once the mouse cursor is moved. Since the installation machine is passive and doesn’t receive any input, the code wouldn’t function.

So I came up with a slightly backwards solution to the problem. Since the key to the solution is to move the cursor, I enabled the Mouse Keys option from the Universal Access preferences panel and wrote a small piece of AppleScript to send a keyboard event simulating the pressing of one of the number keys and thereby moving the mouse. Here’s the script:

tell application “System Events”

repeat 30 times

keystroke “8”

end repeat

end tell