New to scripting want to know if this is possible

I am trying to make a script that:

-When a keystroke is pressed it will pass on that keystroke a to a background application and will continue passing it for as long as you hold it down.

If this is not possible then something like this:

When you hold down a keystroke it will bring the background app to the front then pass the keystroke until the key is released and then move the application back to the back ground leaving the original foreground application back in the front.

Id appreciate any help i could get on this.

To catch keystrokes, you can use Jon’s Commands’ “keys pressed”, but it is not a “listener”. This means that you should create a cpu-intensive repeat loop, anything such as:

repeat
     if (keys pressed) = "A" then
          --> do whatever
     end if
end repeat

To “pass” keystrokes to an app, you need allways bring it to the front and use Apple’s beta “System Events” or Kanzu’s “Extra Suites” (reliable, but shareware; shareware, but great).

Jon’s Commands: http://www.seanet.com/~jonpugh/
Apple’s beta System Events: http://www.apple.com/applescript/GUI/
Kanzu’s Extra Suites: http://www.kanzu.com/