View Full Version : Send keydown command to Safari?

01-23-2011, 01:37 PM

I am using a Wiimote to control a web application running in Safari. I assign a AppleScripts to the buttons on the Wiimote. The AppleScript calls JavaScript functions in the web application.

At the moment, I only get _one_ keypress event. However, I need the information that a key is pressed for a longer time so that die AppleScript function is executed more than once.

Any hints how I can solve this problem?

Thank you!

01-24-2011, 12:33 AM
Hi Bazi,

AppleScripts can only be triggered, there is no way to have the value of the parameter that triggers the script.
I can suggest two solutions though:

1. Use Demux (Control-D) on the message of the button and trigger the button again. This will split the button values in two messages (0 and 1) to which you now can use to assign two different scripts. I am not a big fan of this solution because AppleScripts can be slow to execute and if two AppleScripts are executed to fast, it could lock the application.

2. Try another way to communicate with the web application, if at all possible: You could use for example flosc which is Flash gateway between Flash and OSC. From Flash, I think you could execute your javascript. More information about flosc here: http://transmote.com/flosc/