|
|
|
06-14-2018, 10:23 AM
|
#1
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
API: Access to "ReaScript: Run reaScript (EEL, lua, or python)..."
Since some tasks are better suited for one scripting language over another (Lua for ease of writing and better GUI capabilities, EEL for audio processing, etc), it would be really handy if scripts of different languages could call each other just like a user clicking ReaScript: Run reaScript (EEL, lua, or python)... on their own.
At a basic level, it could look like:
Code:
--Lua script
reaper.SetExtState("my_script", "vars", "1,5,a")
reaper.RunReaScript("Scripts/my_other_script.eel")
-- EEL script (written as Lua because I suck at EEL)
vars = reaper.GetExtState("my_script", "vars")
retvals = do_some_complicated_audio_processing_using(vars)
reaper.SetExtState("my_script", "retvals", retvals)
--Lua script
reaper.defer(keep_checking_for_ExtState_retvals)
reaper.ShowConsoleMsg("Got the following retvals: " .. retvals)
Or, if some kind, generous, and sexy developer felt like it, passing arguments back and forth to avoid all the ExtState business:
Code:
--Lua script
local retvals = reaper.RunReaScript("my_other_script.eel", arg1, arg2, etc)
Cheers.
|
|
|
06-14-2018, 10:28 AM
|
#2
|
Human being with feelings
Join Date: Apr 2014
Posts: 4,175
|
Quote:
Originally Posted by Lokasenna
Or, if some kind, generous, and sexy developer felt like it, passing arguments back and forth to avoid all the ExtState business:
Code:
--Lua script
local retvals = reaper.RunReaScript("my_other_script.eel", arg1, arg2, etc)
|
This would be amazing!!
|
|
|
06-14-2018, 12:00 PM
|
#3
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,902
|
+1. !!
|
|
|
06-15-2018, 06:22 AM
|
#4
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Yes please!!
|
|
|
06-15-2018, 07:00 AM
|
#5
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
+1000
Especially the parameter/avoiding extstate-stuff
@lokasenna
Regarding your first FR, do you mean, mixture of several programming languages in one script, so ReaScript would treat the individual parts of the code as individual scripts during execution?
|
|
|
06-15-2018, 07:33 AM
|
#6
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by mespotine
+1000
Especially the parameter/avoiding extstate-stuff
@lokasenna
Regarding your first FR, do you mean, mixture of several programming languages in one script, so ReaScript would treat the individual parts of the code as individual scripts during execution?
|
Sort of - being able to call an EEL script from a Lua script. They would be completely separate processes, which we can already do manually:
- Run the Lua script
- Have it store some variables
- Use the action list to run the EEL script
- Have it load the variables and do stuff
- Have it save the returned value
- Have the Lua script waiting with a defer loop until it sees the returned value as an ExtState
At the moment we can do this via Main_OnCommand if the EEL script is registered as an action, whereas being able to call them directly would mean only your "main" script needs to show up. If a script had several different audio processing features written in EEL with a Lua frontend, direct access would be much simpler.
|
|
|
10-27-2018, 05:11 PM
|
#7
|
Human being with feelings
Join Date: Aug 2017
Posts: 336
|
Quote:
Originally Posted by Lokasenna
At the moment we can do this via Main_OnCommand if the ... script is registered as an action...
|
What's the difference between an Action ID and a Command ID?
How does one register a script as an action, and can that action be called from outside of Reaper, ... saaayyy Autohotkey, perhaps?
|
|
|
10-28-2018, 06:08 AM
|
#8
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
|
Quote:
Originally Posted by tXShooter
What's the difference between an Action ID and a Command ID?
|
A script is registered as an action when it's loaded in the Action List. Command is a synonym for action. But to answer your question: there are two kinds of command IDs. The built-in actions have a fixed numeric ID which can be directly used. Extension plugin, custom and script actions are identified by a "named command ID" (for scripts it's a hash derived from the path). These actions also have an underlying numeric ID but, because it's determined at runtime, it's not guaranteed to always be the same.
A named command ID must be converted to its current underlying numeric ID using NamedCommandLookup before being able to run the script using Main_OnCommand or an external program like AutoHotkey posting a WM_COMMAND message.
Last edited by cfillion; 10-28-2018 at 06:45 AM.
|
|
|
10-28-2018, 09:37 AM
|
#9
|
Human being with feelings
Join Date: Aug 2017
Posts: 336
|
Quote:
Originally Posted by cfillion
A named command ID must be converted to its current underlying numeric ID using NamedCommandLookup before being able to run the script using Main_OnCommand or an external program like AutoHotkey posting a WM_COMMAND message.
|
I'm guessing that when you say, "... because it's determined at runtime, it's not guaranteed to always be the same", that these Command ID's aren't dependable from one Reaper Session to the next?
In theory then, could one create a small script to output the list of Command ID's (via NamedCommandLoopkup to either console, clipboard, or file), and register that script to a hotkey, then have that hotkey activated by AHK? Then AHK could receive that information, and from that point any 'registered' scripts could be used externally and dependably (during that Reaper session only, of course).
Does that make sense and sound about right?
|
|
|
10-28-2018, 10:11 AM
|
#10
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
|
Quote:
Originally Posted by tXShooter
Does that make sense and sound about right?
|
That would work. Alternatively, if AHK supports making HTTP requests, you could use REAPER's web interface feature. It allows running actions from the main section directly using their named command IDs: /_/command-id-or-named-command-id-here.
Last edited by cfillion; 10-28-2018 at 10:20 AM.
|
|
|
10-17-2021, 10:20 AM
|
#11
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,146
|
Bump........
|
|
|
07-04-2022, 03:09 PM
|
#12
|
Human being with feelings
Join Date: Sep 2017
Posts: 518
|
+1
|
|
|
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 05:40 PM.
|