|
|
|
08-16-2017, 09:45 AM
|
#1
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
req: Actions accept Arguments and do Returns
I mean would be nice if in the actions panel the actions could accept arguments probably just if declared to be accepted by the script .
Same script could be used several times with different arguments.
This makes easier for scripting, i guess better to the end user because he will have better scripts and more control.
And doing returns, would allow adding reusability (as a lib) by other actions.
Thank you
edit: edited for adding things ...
Last edited by deeb; 03-30-2019 at 03:04 AM.
|
|
|
08-16-2017, 10:13 AM
|
#2
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
+1000 for this!!
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
08-16-2017, 02:24 PM
|
#3
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Yes, i very want this, would be great !!
|
|
|
08-16-2017, 07:37 PM
|
#4
|
Human being with feelings
Join Date: Jun 2008
Posts: 4,923
|
Please!
|
|
|
08-16-2017, 11:44 PM
|
#5
|
Human being with feelings
Join Date: Apr 2011
Posts: 499
|
This could also address my pet peeve, lots of identical actions that differ only in track or group number. Unrelated to scripts.
|
|
|
08-17-2017, 09:17 AM
|
#6
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
this could go from a simple textbox where to insert values or a simple gui to edit values like for EEL effects, but edited in the action panel or similar;
like:
slider1:0<0,15,1{1,2,3,4,5,6,7,8,9,10,11,12,13,14, 15,16}>Output MIDI Channel
i guess it would open lot's of possibilities.
Also, with arguments in actions there would open the chance to abuse from calls from other scripts, and people might start writing stuff that does nothing directly because their point is to be consumed by other scripts. The paradigma in scripting perspective would change quite a lot i think
just shooting in the air!
thanks
Last edited by deeb; 08-17-2017 at 10:25 AM.
|
|
|
08-19-2017, 05:24 AM
|
#7
|
Human being with feelings
Join Date: Sep 2015
Posts: 690
|
That would be awesome.
Masi
|
|
|
08-22-2017, 08:50 AM
|
#8
|
Human being with feelings
Join Date: Jun 2008
Posts: 4,923
|
please please!
|
|
|
12-22-2017, 04:20 PM
|
#9
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
one bump!
|
|
|
01-29-2018, 05:05 AM
|
#10
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,622
|
+10000
Would make things a ton easier!
|
|
|
01-29-2018, 05:24 AM
|
#11
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
YES Please !
|
|
|
07-12-2018, 08:23 AM
|
#12
|
Human being with feelings
Join Date: Aug 2010
Location: Sweden
Posts: 24
|
Really disappointed you couldn't do this, wasted a bunch of time writing a script.
Also maybe related, would be nice if scripts could tell what key invoked it (use one script for several functions).
|
|
|
07-12-2018, 08:27 AM
|
#13
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by Cyaoeu
Also maybe related, would be nice if scripts could tell what key invoked it (use one script for several functions).
|
Scripts can get their own filename, so if you copy/paste the same code with different filenames it can read the name and do something accordingly. Alternatively, ReaPack can handle the copying and renaming when it installs a package - cfillion and I both have scripts that make use of it to provide multiple actions.
It's also possible for a script to generate a completely new script - a few of mine let you export settings as a separate action, whereupon they copy the relevant code into a new file with an appropriate filename for the script to parse.
+1 to the FR, though. Lua happily accepts command line arguments, so as far as Lua goes we'd just need a dialog for "action name: ___ action arguments: ___".
Last edited by Lokasenna; 07-12-2018 at 08:48 AM.
|
|
|
07-12-2018, 08:51 AM
|
#14
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Lokasenna: that is true, but would be great if we could rely on complex functions (scripts) calling them by arguments and they could return a value.
It would be another paradigm for reascripts
|
|
|
07-12-2018, 09:01 AM
|
#15
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by deeb
Lokasenna: that is true, but would be great if we could rely on complex functions (scripts) calling them by arguments and they could return a value.
It would be another paradigm for reascripts
|
Can you describe a use case? This FR would make it much easier, but what you describe is already possible to an extent.
|
|
|
07-12-2018, 10:03 AM
|
#16
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Lokasenna
Can you describe a use case? This FR would make it much easier, but what you describe is already possible to an extent.
|
example:
Code:
trim (db)
{
if trim() return true
else return false
}
or
Code:
getAllSelectedItemsInTrack(trackId)
{
ArrayOfItems = doSomethingToGetThem()
return ArrayOfItems
}
or a complex debugging function
or any function that can be reusable between scripts, basically working as reusable methods (which can be as complex or specific as users want).
i can try and think more about it if the examples are not enough! anyway! i am aware this might lead to dependency managing/complexity which should be thought, like reapack read declared dependencies on a script and ask user if wants to install dependencies, just saying ...
Last edited by deeb; 07-12-2018 at 10:27 AM.
|
|
|
07-12-2018, 10:30 AM
|
#17
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
But... don't you need a script to take that and do something with it?
It seems like what you're describing is a higher-level scripting language to serve as a middleman between Custom Actions and Lua, something readable/writable by the average user.
|
|
|
07-12-2018, 10:43 AM
|
#18
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Lokasenna
But... don't you need a script to take that and do something with it?
It seems like what you're describing is a higher-level scripting language to serve as a middleman between Custom Actions and Lua, something readable/writable by the average user.
|
yes we need a script, that could reuse third party functions this way and it would work For average or advanced user!
Maybe i am talking about 2 different things: external libs and arguments.
The thing is that if a script could receive arguments and return something, it could be used as an external lib and also a script like trim (db) could be called directly as an action being "db" a variable.
Anyway! : )
|
|
|
07-12-2018, 11:07 AM
|
#19
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
External libraries are already doable. My GUI library is on ReaPack, and comes with an "install" script that just makes a note of where it's been placed so other scripts can look for it. Would be easier if ReaPack could handle the dependency checking itself, but it's still pretty basic. Takes maybe four lines of code.
Arguments and returns are also doable, within script-world at least.
|
|
|
07-12-2018, 11:14 AM
|
#20
|
Human being with feelings
Join Date: Dec 2012
Posts: 13,333
|
+1 for this FR.
|
|
|
07-12-2018, 11:14 AM
|
#21
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Lokasenna
Arguments and returns are also doable, within script-world at least.
|
Between 2 different scripts? Both not knowing about each other like: require in your Gui. Edit: OP is about not inside script world anyway, in script world it would be a consequence.
Thank you for the insights
Last edited by deeb; 07-12-2018 at 11:26 AM.
|
|
|
07-12-2018, 11:33 AM
|
#22
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by deeb
Between 2 different scripts? Both not knowing about each other like: require in your Gui.
|
Yup. As far as Lua is concerned, a .lua file is the same as a function - rather, they're both just chunks of code. For example, Lua is normally run from the command line, where scripts can be given arguments and can return values to the command line that don't require any extended knowledge on their part.
Quote:
Edit: OP is about not inside script world anyway, in script world it would be a consequence.
|
Understood. Being able to specify "pass the script this value: 'drum bus' " would be wonderful, and wouldn't break anything if an existing action/script wasn't expected any arguments.
|
|
|
07-13-2018, 07:00 PM
|
#23
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Lokasenna
Yup. As far as Lua is concerned, a .lua file is the same as a function - rather, they're both just chunks of code. For example, Lua is normally run from the command line, where scripts can be given arguments and can return values to the command line that don't require any extended knowledge on their part.
|
but that is outside reaper script world as far as i know
|
|
|
07-13-2018, 07:09 PM
|
#24
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
A Lua script doesn't care. At most, Reaper would just have to take the returned value from Script 1 and pass it as an argument to Script 2.
You could do it now with ExtStates - Script 1 does stuff and stores its final value under some specific key in reaper-extstate.ini, Script 2 looks for that specific key and grabs the value there. Script 1 and 2 don't have to know anything about each other, just that they're using that location to pass data around.
Random example using made-up actions:
Code:
Select all items
Script 1: Store the name of the track with the most selected items
Set time selection to current arrange view
Script 2: Delete all items on the named track that are outside the time selection
Script 1 can be swapped out with anything that stores a track name based on whatever criteria you want, as long as the name is stored in that location. Script 2 can be swapped out with anything that takes a track name and does something, as long as there's a name for it to find.
They don't even have to be talking about the same thing - if one scripter just made a bunch of scripts like:
Code:
store the number 1
store the number 2
store the number 3
then another scripter could make:
Code:
select track __
select item __ on the current track
select take __ in the current item
nudge the edit cursor __ seconds to the right
set the time selection __ measures long
Again, the original FR would be nice, and would make this process much simpler, but it's quite doable with what we have.
Last edited by Lokasenna; 07-13-2018 at 07:16 PM.
|
|
|
07-13-2018, 07:19 PM
|
#25
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Lokasenna
...
|
i see! thanks! but so it does not work in reaper world, ExtState could workaround but adds complexity and not tempting to be used or abused !
Cheers! Good night : )
|
|
|
07-13-2018, 07:35 PM
|
#26
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Not really any room for abuse, and it's not very complicated. The hardest part would be getting more than one scripter to agree on what key name to use for the saved data.
|
|
|
07-14-2018, 05:26 AM
|
#27
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Lokasenna
Not really any room for abuse, and it's not very complicated..
|
arguments and returns can theorically be as simple as string or a value or all globals in a script or a function so, I am not sure if you are right when you say exstate would not add complexity, and as far as i can see, if was as simple args and returns should be: there would be a very big room for abuse IMO.
|
|
|
07-14-2018, 05:48 AM
|
#28
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Complexity:
You're correct that the shared key could be used to pass a lot of information, but that's up to the scripters involved. It's actually pretty trivial to take a large amount of data, turn it into a string, then reload it later and get the data back - scripters just need to agree on a format.
There would be zero complexity added for the end user, which is really the whole point - solutions that don't need require technical knowledge to use.
Abuse:
Any script can be malicious if it wants to. It could use the Reaper API to delete every file in the project, or even other stuff on your hard drive if you aren't running in Restricted Permissions mode.
This approach would actually make it much harder for such abuse to happen because Lua doesn't just execute whatever string of code you give it. Unless a script was dumb enough (as in, doing it on purpose) to load an unknown string and execute it as code, it's just a string. It can't do anything.
|
|
|
07-14-2018, 06:32 AM
|
#29
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Lokasenna
Abuse: ...
|
sorry, i translated from my own language a slug expression: "abuse". I don't mean security abuse, .. i mean: use a lot because it tastes good and there is a lot : ) a feast! just that.
Quote:
Originally Posted by Lokasenna
Complexity:
You're correct that the shared key could be used to pass a lot of information, but that's up to the scripters involved. It's actually pretty trivial to take a large amount of data, turn it into a string, then reload it later and get the data back - scripters just need to agree on a format.
|
that can be true! but exstate is a file, that file will get size increase, perfomance decreases too compared from reading and writting on memory, more garbage information needs cleaning.
We both agree it is not so elegant as it could apparently be?
|
|
|
07-14-2018, 06:39 AM
|
#30
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by deeb
sorry, i translated from my own language a slug expression: "abuse". I don't mean security abuse, .. i mean: use a lot because it tastes good and there is a lot : ) a feast! just that.
|
"Overuse".
Quote:
that can be true! but exstate is a file, that file will get size increase, perfomance decreases too compared from reading and writting on memory, more garbage information needs cleaning.
|
The key would be cleared automatically by Reaper on close, unless you specifically asked for it to be kept. No problems there.
|
|
|
07-14-2018, 08:18 AM
|
#31
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Lokasenna
"Overuse".
|
yes : ) and i mean overused because each script can be seen as a library by their own, so say someone writes:
timeStreach(item).v1.lua
Code:
function timeStreach(item)
if item == nil then item = selectedItem() end
ok = applyTimeStreach(item)
return ok
}
if someone needed it in another script for some reason, it just needs to be sure script exists and call it. Simple - no protocols needed or requires. And this could be an invitation to be overused in all direction: good, bad and the ugly, if you know what i mean :P
Full libraries could be managed this way! in a good way with some community commitment.
|
|
|
07-14-2018, 09:01 AM
|
#32
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by deeb
if someone needed it in another script for some reason, it just needs to be sure script exists and call it. Simple - no protocols needed or requires.
|
That's what require does, though - it looks for a particular script and loads it. That's how libraries are managed in pretty much any language.
It would be a little simpler (only a little, because it's not too hard now) if ReaPack allowed us to check "Is Lokasenna's GUI library installed? If not, install it." As is, a script needing my GUI just has to pop up a message box saying "Hey, the GUI library isn't here. Please install this package: ____ from ReaPack."
|
|
|
07-14-2018, 09:41 AM
|
#33
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Lokasenna
That's what require does, though - it looks for a particular script and loads it. That's how libraries are managed in pretty much any language.
|
yes it is! this would be 1 more way with pros and cons to do so, or maybe just a tinny little different perspective. In non scripting languages this wound't make sense at all .. why limit scripting and not take advantage of it's nature?
There are many examples of frameworks that take huge advantage from being a scripting language and this is kind of the same situation.
This way a script can be written with both in mind: a user, or another script - that's it. Like in the timeStretch example. It's not a lib but it can serve as so.
Quote:
Originally Posted by Lokasenna
It would be a little simpler (only a little, because it's not too hard now) if ReaPack allowed us to check "Is Lokasenna's GUI library installed? If not, install it." As is, a script needing my GUI just has to pop up a message box saying "Hey, the GUI library isn't here. Please install this package: ____ from ReaPack."
|
yep, dependency managing would be really nice. Maybe a pre declared thing would make things easier there?
like:
Code:
--[[
reapackDependency:Lokasenna's.GUI.v1.lua
reapackDependency:LBX Super Knobs.v1.lua
]]
Last edited by deeb; 07-14-2018 at 10:27 AM.
|
|
|
07-14-2018, 11:19 AM
|
#34
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I asked cfillion about adding dependencies to ReaPack. Don't remember getting an answer though.
|
|
|
07-18-2018, 09:59 AM
|
#35
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
|
|
|
10-10-2018, 03:17 AM
|
#36
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
+ hope!
|
|
|
10-15-2018, 09:05 AM
|
#37
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,622
|
I'm working on something, that works like that to some extend, that you can pass parameters and get retvals returnd by scripts.
Still in early stages though and is missing the part, that you can pass over parameters from the actionlist itself.
|
|
|
03-23-2019, 06:48 AM
|
#38
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by mespotine
I'm working on something, that works like that to some extend, that you can pass parameters and get retvals returnd by scripts.
Still in early stages though and is missing the part, that you can pass over parameters from the actionlist itself.
|
cool mespotine! how is it going?
Native better! i'd say!
|
|
|
03-24-2019, 02:48 PM
|
#39
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,622
|
Already part of he current version, called "Child Scripts". Still has some bugs that'll be fixed next week.
Is the major base in my collab with lokasenna
|
|
|
03-24-2019, 10:24 PM
|
#40
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
wow! : ) looking forward for this mespotine!
It opens a lot of things !!! Maybe next reaper just needs to support allowing adding more instances of same script in action list !
|
|
|
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 06:31 AM.
|