Page 1 of 1

How to make Flowstone send PC keyboard key-press commands?

PostPosted: Thu Apr 05, 2018 5:25 pm
by keyjslider1
Dear Sirs,

by default the Flowstone reacts to PC keybord key-press messages by means of standard prim "Is Key Pressed".
Is there the way to perform the opposite operation (like with MIDI Message prim) - to send (emulate) specific key-pressed messages out of Flowstone, in my case, to the DAW host?
My need is to emulate "Home" key pressure command to send out of Flowstone to activate/reset FL Studio mixer channel position.
I guess there might be neccessary to address to external API32 application?

Would very much appreciate someone to share ideas and possibly, the code examples.... Thanks in advance.

Re: How to make Flowstone send PC keyboard key-press command

PostPosted: Fri Apr 06, 2018 9:05 am
by tulamide
This belongs to "General", as it is not at all about DSP ;)

I never used it myself, so I don't have Ruby code for you, but what you need is from the Windows API

SendMessage (with the WM_KEYUP or WM_KEYDOWN message)
Windows Dev Center link

However, the function expects a handle to the window that will receive the message, which will require you to find out that handle. I'm a little lost on that topic, maybe somebody else can help with that?

Moderator comment: I've moved this to General. Now why didn't I spot that it was in the wrong sub-forum? Too old.

Re: How to make Flowstone send PC keyboard key-press command

PostPosted: Sat May 26, 2018 9:14 pm
by keyjslider1
tulamide wrote:This belongs to "General", as it is not at all about DSP ;)
I never used it myself, so I don't have Ruby code for you, but what you need is from the Windows API...
Moderator comment: I've moved this to General. Now why didn't I spot that it was in the wrong sub-forum? Too old.


Tulamide thank you, SendKey and SenMessage do not work out of Flowstone as a FLStudio plugin, but Postmessage works fine. For my purpose I used keybd_event command, I didn't need finding out the window handle because the target window was always on top when the desired code had to be applied. I used the following code to send "Home" key in order to reset the FL's mixer position^
require "Win32API"
g=Win32API.new("user32","keybd_event", ['i','i','p','i'])
g.call(36,0,0,0)
g.call(36,0,'KEYEVENTF_KEYUP',0)