Old 12-25-2016, 03:13 AM   #1
azrulsaleh
Human being with feelings
 
Join Date: Mar 2016
Posts: 5
Default Keystrokes Possible in Reascript?

Is there a way to perform keystrokes through reascripts? Like say output "100" and then return key?
azrulsaleh is offline   Reply With Quote
Old 12-25-2016, 03:28 AM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

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.
cfillion is offline   Reply With Quote
Old 12-25-2016, 07:46 AM   #3
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

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.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 12-25-2016, 11:13 PM   #4
azrulsaleh
Human being with feelings
 
Join Date: Mar 2016
Posts: 5
Default

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.
azrulsaleh is offline   Reply With Quote
Old 12-25-2016, 11:30 PM   #5
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by azrulsaleh View Post
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 View Post
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.
cfillion is offline   Reply With Quote
Old 12-26-2016, 06:49 PM   #6
azrulsaleh
Human being with feelings
 
Join Date: Mar 2016
Posts: 5
Default

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.
azrulsaleh is offline   Reply With Quote
Old 12-26-2016, 06:54 PM   #7
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

The amount of slots is customisable in S&M.ini.
cfillion is offline   Reply With Quote
Old 12-26-2016, 09:56 PM   #8
azrulsaleh
Human being with feelings
 
Join Date: Mar 2016
Posts: 5
Default

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!
azrulsaleh is offline   Reply With Quote
Old 12-27-2016, 12:38 AM   #9
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

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
mschnell is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.