|
|
|
09-23-2019, 08:50 PM
|
#1
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Lua: Generate script from custom action
Last edited by Lokasenna; 09-25-2019 at 06:51 AM.
|
|
|
09-23-2019, 10:19 PM
|
#2
|
Human being with feelings
Join Date: Dec 2009
Location: Oblivion
Posts: 10,255
|
No way. Does it work for cycle actions? Trying this now...
Damn. Doesn't work. Would love to turn all my CA into scripts... Thanks anyway.
|
|
|
09-24-2019, 05:57 AM
|
#3
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I did mention that in the OP. :P The file format for cycle actions is really easy, so I'm hoping to have one for them some time soon.
|
|
|
09-24-2019, 07:31 AM
|
#4
|
Human being with feelings
Join Date: Dec 2009
Location: Oblivion
Posts: 10,255
|
Derp. I'll learn how to read one of these days, I swear.... But seriously, that might be enough for me to get my head around scripting.
No more opening that clunky CA editor and I'll finally be able to keep all the unnecessary ones out of the Undo History.
|
|
|
09-24-2019, 10:21 AM
|
#5
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
Holy molly...
Much appreciated !
Gonna try this for sure tomorrow.
Thx for y’all talents...
Life saver lol
|
|
|
09-24-2019, 10:25 AM
|
#6
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
If I get it right, it creates a script which runs the given actions just like the "regular-actions-combination-concept" in Reaper?
|
|
|
09-24-2019, 10:33 AM
|
#7
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Pretty much - it just reads reaper-kb.ini to get the list of commands and spits out the Main_OnCommand for them, with options for PreventUIRefresh and Undo_BeginBlock.
|
|
|
09-25-2019, 01:51 AM
|
#8
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
Quote:
Originally Posted by Lokasenna
I've seen this requested a few times, mostly because scripts are so much easier to share with other users.
1. Run the script.
2. Paste the ID for a custom action. (No cycle actions... yet)
3. Press 'Go'.
4. Go find your new file in the same folder as the script.
Lokasenna_Generate script from custom action is available now on your friendly neighbourhood ReaPack.
|
What is this script doing? If I have a custom action 40 actions, will this script combine them in such a way, I have only a single new script which does exactly same? If yes, how does it do this magic? It can not be just a simple copy and paste?
|
|
|
09-25-2019, 01:58 AM
|
#9
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
Quote:
Originally Posted by foxAsteria
No way. Does it work for cycle actions? Trying this now...
|
Anything should be possible what is possible with lua.
Rather than being "only" a recreation of original custom action, it could go one step beyond, by allowing certain extras, like checking for certain cases then doing different things for each. I have no good example now, but what comes to my mind something general like:
- detecting peak/resonant frequencies first
- then doing for each peak/resonant frequency something, like adding a sharp notch
Or frequency sweeping, then doing something with the peaks.
|
|
|
09-25-2019, 06:28 AM
|
#10
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by TonE
What is this script doing? If I have a custom action 40 actions, will this script combine them in such a way, I have only a single new script which does exactly same? If yes, how does it do this magic? It can not be just a simple copy and paste?
|
Exactly that.
Quote:
Originally Posted by TonE
Anything should be possible what is possible with lua.
Rather than being "only" a recreation of original custom action, it could go one step beyond, by allowing certain extras, like checking for certain cases then doing different things for each. I have no good example now, but what comes to my mind something general like:
- detecting peak/resonant frequencies first
- then doing for each peak/resonant frequency something, like adding a sharp notch
Or frequency sweeping, then doing something with the peaks.
|
That's definitely a LOT more complicated, but I've been toying with a similar idea for ages - look at Cubase's Project Logical Editor for an example of what could be done.
|
|
|
09-25-2019, 06:35 AM
|
#11
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
Generate script from custom action.lua:28: attempt to call a nil value.
is it something I'm missing here ?
I'm using mac btw.
couldnt find this script on my ReaPack browser so I searched it from GitHub.
:/
|
|
|
09-25-2019, 06:47 AM
|
#12
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
If it's crashing there you probably don't have my GUI library installed, but it should be giving you a specific error message telling you that.
- Run Extensions -> ReaPack -> Synchronize packages
- Open the ReaPack browser
- Search for "Lokasenna's GUI library v2 for Lua" and select it to install
- Search for "Generate script from custom action" and select it to install (I just checked and it IS showing up on ReaPack)
- In your action list, run "Set Lokasenna_GUI v2 library path".
- You should be able to run "Generate script from custom action" now.
|
|
|
09-25-2019, 06:51 AM
|
#13
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Added some example images to the OP since my explanation apparently sucked.
|
|
|
09-25-2019, 10:33 PM
|
#14
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
Quote:
Originally Posted by Lokasenna
- In your action list, run "Set Lokasenna_GUI v2 library path".
- You should be able to run "Generate script from custom action" now.
|
thanx!
Ah-ha! it works now, thanx for the tip!
Didn't know I gotta run "Set Lokasenna_GUI v2 library path" 1st.
Many thanx! Much appreciated.
|
|
|
09-26-2019, 04:22 AM
|
#15
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
Didn’t try it yet, but does it work with CAs that have some CONSOLE actions in them?
|
|
|
09-26-2019, 04:37 AM
|
#16
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
|
Holy Moly!!!
Absolutely brilliant idea!!
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
09-26-2019, 05:59 AM
|
#17
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by lexaproductions
Didn’t try it yet, but does it work with CAs that have some CONSOLE actions in them?
|
I don't see why it wouldn't.
|
|
|
09-26-2019, 07:01 AM
|
#18
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
Well I didn’t even know you could address the reaconsole from the lua API
|
|
|
09-26-2019, 07:57 AM
|
#19
|
Human being with feelings
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 957
|
Thanks for the great script!
Sorry for the semi-offtopic. But, I'm curious. What is the advantage of scripts over customs? Is it just convenience, or are there any technically important details?
|
|
|
09-26-2019, 08:04 AM
|
#20
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
There are no advantages, except it is a single file, but custom actions are maybe also a single file somewhere, not sure, if not that would be one advantage. Weakness is still this script is still dependent on possible many other scripts. Cool would be if this dependency would be removed, what I thought first. So from my perspective there are no advantages.
|
|
|
09-26-2019, 08:32 AM
|
#21
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by lexaproductions
Well I didn’t even know you could address the reaconsole from the lua API
|
You can't - this is just using whatever commands are in your custom action. There are actions for things like "Open ReaConsole with 'v' to do whatever it is that 'v' does" - are we talking about something more than that?
Quote:
Originally Posted by cool
Sorry for the semi-offtopic. But, I'm curious. What is the advantage of scripts over customs? Is it just convenience, or are there any technically important details?
|
1. Sharing.
Custom actions are all stored in one .ini file, so you would have to open that file, find the right action, copy the entire line and post it somewhere. Then someone else would have to copy it, open their copy of that file, paste it in, and reload Reaper. I'm not even sure if that works because Reaper generates a custom ID for the script, so copy/pasting to a different machine might cause trouble.
In contrast, a script is just a file that you load from the action list. Or upload to ReaPack.
2. Efficiency.
Some custom actions, especially if they're doing more things or being used in a larger project, might take a bit of time to operate - you can sometimes even see it doing X to one track at a time. This is because Reaper updates its UI each time you do something, and UI updates are really "expensive" compared to just shuffling information around under the hood.
Scripts can tell Reaper to pause the UI while they run so all of that appears to happen at once. I've had scripts take 30 seconds because of UI updates and drop down to less than 1 with the UI paused.
Quote:
Originally Posted by TonE
Weakness is still this script is still dependent on possible many other scripts. Cool would be if this dependency would be removed, what I thought first.
|
That would be pretty cool. I'll add it to my giant list of ideas.
|
|
|
09-26-2019, 09:36 AM
|
#22
|
Human being with feelings
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 957
|
Quote:
Originally Posted by Lokasenna
1. Sharing.
Custom actions are all stored in one .ini file, so you would have to open that file, find the right action, copy the entire line and post it somewhere. Then someone else would have to copy it, open their copy of that file, paste it in, and reload Reaper. I'm not even sure if that works because Reaper generates a custom ID for the script, so copy/pasting to a different machine might cause trouble.
In contrast, a script is just a file that you load from the action list. Or upload to ReaPack.
2. Efficiency.
Some custom actions, especially if they're doing more things or being used in a larger project, might take a bit of time to operate - you can sometimes even see it doing X to one track at a time. This is because Reaper updates its UI each time you do something, and UI updates are really "expensive" compared to just shuffling information around under the hood.
Scripts can tell Reaper to pause the UI while they run so all of that appears to happen at once. I've had scripts take 30 seconds because of UI updates and drop down to less than 1 with the UI paused.
|
Thanks for the detailed answer!
|
|
|
09-26-2019, 01:15 PM
|
#23
|
Human being with feelings
Join Date: Dec 2017
Posts: 179
|
This script is awesome thanks so much!
|
|
|
09-26-2019, 02:40 PM
|
#24
|
Human being with feelings
Join Date: Jan 2010
Location: Kalispell
Posts: 14,745
|
Hi Loka, this is great, I've got hundreds, and hundreds, and hundreds of custom actions and there's several of the I'd like to put in a script.
Question: Do the Command IDs stay the same if I send them to somebody or will they be different?
|
|
|
09-26-2019, 03:06 PM
|
#25
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by Tod
Question: Do the Command IDs stay the same if I send them to somebody or will they be different?
|
Any actions from Reaper or SWS will be fine. Scripts might cause trouble, although if both you and the other user installed them via ReaPack I think they'll be okay because the IDs are (AFAIK) generated based on the file path and ReaPack is consistent in that regard.
|
|
|
11-04-2019, 03:29 PM
|
#26
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,134
|
Thank you, great idea.
One question, i see that scripts which have long alphanumeric IDs are referenced with nice 5 digit long IDs in the generated scripts which aren't found with a simple search in the reaper-kb.ini. How does this work?
|
|
|
11-04-2019, 03:41 PM
|
#27
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
It takes the IDs from reaper-kb.ini and passes them to reaper.NamedCommandLookup. I guess Reaper processes the long names into a shorter ID internally, and that's what it gives back.
|
|
|
11-05-2019, 07:43 AM
|
#28
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,134
|
Quote:
Originally Posted by Lokasenna
It takes the IDs from reaper-kb.ini and passes them to reaper.NamedCommandLookup. I guess Reaper processes the long names into a shorter ID internally, and that's what it gives back.
|
and i gather that these are not cross machine compatible even when another user has the same individual scripts but hosted at different paths, or are they and scripts IDs don't depend on the location or other contingencies and are the same across the board?
Last edited by Buy One; 11-05-2019 at 07:51 AM.
|
|
|
11-05-2019, 07:52 AM
|
#29
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I... don't actually know.
|
|
|
11-05-2019, 01:01 PM
|
#30
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,134
|
Alright, thank you for the explanation
|
|
|
11-05-2019, 02:12 PM
|
#31
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
schwa says here that the command ID numbers for custom actions/scripts are generated at Reaper startup and aren't fixed (unlike for native actions).
edit:
Just to be clear, as mentioned above, the command ID strings are deterministic.
https://forum.cockos.com/showpost.ph...7&postcount=19
Last edited by nofish; 11-05-2019 at 02:36 PM.
|
|
|
11-05-2019, 02:17 PM
|
#32
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by nofish
schwa says here that the command ID numbers for custom actions/scripts are generated at Reaper startup and aren't fixed (unlike for native actions).
|
Thanks. I should probably not have the script use those then... :P
|
|
|
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 02:58 AM.
|