Page 1 of 1

Keyboard output

Posted: Wed Jan 30, 2013 12:44 pm
by IsoJari
Is it possible to use keyboard as output device?

example:

Midi in ---> translate midi values to key --> keyboard output to different program.

Re: Keyboard output

Posted: Wed Jan 30, 2013 2:58 pm
by tester
Specify your question.

You can re-assign keyboard keys (to different functions) using some sort of procedure, but this will work within the FS app only. Or I misunderstood the question?

Re: Keyboard output

Posted: Wed Jan 30, 2013 7:46 pm
by trogluddite
Hi IsoJari, welcome to the forum.

There's no simple primitive or module to do what you ask at the moment, but the new Ruby language in FS is able to make calls to external dll's. So, in principle, you could make calls to the Windows win32api.dll to find the controls on the application window and send keypresses to it.
I've used a quite similar procedure in the 'AutoHotKeys' scripting language in the past - it can be a little long-winded, but it means you can target a very specific control in a single window (or even 'child' window), and won't accidentally trigger shortcut keys in other app's because of having the wrong window in focus.
I haven't tried anything like this in FS, and like most people here, it's still early days with Ruby - but a quick search of programming sites like 'StockOverflow' found some examples of the functions you'd need to access. I couldn't find any Ruby specific code, but the principle will be very similar to the ones in this example that the developers posted.
It is a very good idea though - I can imagine a few users having a use for that, so maybe it's the kind of little project that one of the Ruby wizards here might like to have a go at.