|
|
|
12-25-2016, 03:13 AM
|
#1
|
Human being with feelings
Join Date: Mar 2016
Posts: 5
|
Keystrokes Possible in Reascript?
Is there a way to perform keystrokes through reascripts? Like say output "100" and then return key?
|
|
|
12-25-2016, 03:28 AM
|
#2
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
What is the end goal? Maybe there is another way to do it rather than by simulating keystrokes.
Last edited by cfillion; 12-25-2016 at 03:37 AM.
|
|
|
12-25-2016, 07:46 AM
|
#3
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I was looking into this for my Chord Helper last night, but I don't think it's possible.
It would be really handy, since Reascripts "eat" all keypresses; being able to simulate keypresses to a given hwnd would allow us to pass the keys through to Reaper. The alternative would be to scan the action list to see what that key does and then perform that action via reaper.Main_OnCommand, but from what I can tell not all of the key bindings are stored in reaper_kb.ini.
|
|
|
12-25-2016, 11:13 PM
|
#4
|
Human being with feelings
Join Date: Mar 2016
Posts: 5
|
Hey thanks for the response and Merry Christmas guys!
Well I was toying with the idea of randomly choosing presets of an instrument via a button or shortcut. So say a bass track with 8 synths on it but only 1 of the synths may be active at any time. Then trigger a Reascript to deactivate all fx in chain and activate only 1 random synth in chain.
I've already created a Reascript calling reaper.Main_OnCommand with reaper.NamedCommandLookup to call "SWS/S&M: Resources - Apply track template to selected tracks, prompt for slot". Calling this action will bring up a pop up window to enter a slot value. I'd then generate a random number, and send that value as a keystroke and follow that with a Return or Enter key. All I need now is to send keystrokes via Reascripts to get this idea to work.
Knowing that Reascript "eats" all keypresses is a big pointer that this approach will not work. The only way I can think of to get this idea to run is to rely on external scripting tools like applescript or keyboard maestro to overcome this little keystroke hurdle. It'll be messy but better than nothing I guess.
|
|
|
12-25-2016, 11:30 PM
|
#5
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
Quote:
Originally Posted by azrulsaleh
So say a bass track with 8 synths on it but only 1 of the synths may be active at any time. Then trigger a Reascript to deactivate all fx in chain and activate only 1 random synth in chain.
|
Track FXs can be enabled or disabled with the TrackFX_SetEnabled API function.
Quote:
Originally Posted by azrulsaleh
I've already created a Reascript calling reaper.Main_OnCommand with reaper.NamedCommandLookup to call "SWS/S&M: Resources - Apply track template to selected tracks, prompt for slot". Calling this action will bring up a pop up window to enter a slot value. I'd then generate a random number, and send that value as a keystroke and follow that with a Return or Enter key.
|
Couldn't you just use the action for the desired slot directly? _S&M_APPLY_TRTEMPLATE1, _S&M_APPLY_TRTEMPLATE2, etc
Last edited by cfillion; 12-25-2016 at 11:37 PM.
|
|
|
12-26-2016, 06:49 PM
|
#6
|
Human being with feelings
Join Date: Mar 2016
Posts: 5
|
Nice! Tried the TrackFX_SetEnabled API function and it works like a charm! Thank you cfillion for pointing that out.
In regards to your latter suggestion, executing the action for the desired slot directly is limited by what's provided in the SWS dylib. It'd be nice if we could set say _S&M_APPLY_TRTEMPLATE25 and it will replace the track with a track template in the 25th slot. But because only 4 slots are provided, prompt for slot seems to be the only workaround to call for slots beyond what's given.
|
|
|
12-26-2016, 06:54 PM
|
#7
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
The amount of slots is customisable in S&M.ini.
|
|
|
12-26-2016, 09:56 PM
|
#8
|
Human being with feelings
Join Date: Mar 2016
Posts: 5
|
Oh my god my jaw just dropped. I had no idea we could do this! Man, you just opened open a whole world of possibilities for me. Thank you so much!
|
|
|
12-27-2016, 12:38 AM
|
#9
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
|
The possibilities all the available Reaper extensions offer is incredible. Unfortunately sometimes stuff is hard to find and to use due to lack of documentation and common searchable information. So these formus are likely the best start.
Been there: for my purpose "SWS LiveConfigs" plus "MidiToReaControlPath" was exactly what I needed but it took me several weeks researching and a lot of tenacity to find out, as it was very rarely mentioned together anywhere, and if then depreciated as hard to do (and it's not yet foreseeable when it will be available via the great upcoming tool for exactly this: ReaPack). So I did the documentation but same is not easily found, either .
-Michael
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:40 PM.
|