Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Feature Requests

Reply
 
Thread Tools Display Modes
Old 01-25-2018, 02:28 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default Deferred scripts: Let script itself decide whether to terminate or create new instanc

At present, when a deferred (looped) script is already running in the background when its shortcut is pressed again, REAPER pops up the following window:

Quote:
ReaScript task control

"Script name" is running in the background.

Would you like to terminate all instances of this script, or launch a new instance?

x Remember my answer for this script.
New users can easily be confused by this popup, and if "Remember my answer" is checked, it is tricky to correct an incorrect answer.

Since script authors typically know beforehand whether their scripts should terminate or re-launch, I suggest that scripts should be able the answer the question themselves.

Perhaps the defer or runloop functions should gain an optional extra boolean or integer parameter, to indicate whether the script should automatically terminate or re-launch:
[EDIT: Not boolean, since we actually need a third option too: ignore (cancel).]

Code:
reaper.defer(function name or anonymous function definition, optional boolean terminateOptional)

Last edited by juliansader; 08-20-2018 at 11:20 AM.
juliansader is offline   Reply With Quote
Old 01-25-2018, 07:23 AM   #2
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default

this is particularly relevant if reaper wants to have a better integration of scripts GUI done by community.

very useful and "related" to what has been talked here:
https://forum.cockos.com/showthread.php?t=200142
deeb is offline   Reply With Quote
Old 01-25-2018, 08:22 AM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

This can be done using an external state, that signals "script already running". You would need to change this state again, when ending the " primary" script.

You can set the selection of the "script already running" dialog in the reaper-kb.ini but this change needs a restart in Reaper, that's why you can't change that at runtime.

I would love to see
a) get_action_context() returning the instance-number of the script, so you can easily see, whether it's already running
b) an additional parameter in AddRemoveScript() to set, if multiple instances are possible or not(as if you'd clicked the buttons in the "instance already running-dialog")
c) it would be fantastic to have a function, that returns a list of all running scripts and the number of instances, so monitoring would be possible. Maybe with a way of terminating scripts
d) if the above isn't possible, an action that forces rereading all config-files, so changing the the kb.ini in the back would work, without annoying the user
Meo-Ada Mespotine is online now   Reply With Quote
Old 01-25-2018, 10:56 AM   #4
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by mespotine View Post
This can be done using an external state, that signals "script already running". You would need to change this state again, when ending the " primary" script.
This can work if there are two separate scripts, with the primary (non-looping) script starting the secondary (looping) script via OnCommand.

Unfortunately, I don't think it will work with single scripts: AFAIK, REAPER pops up the dialog box *before* starting the script, so the script does not get the chance to check extstates.
juliansader is offline   Reply With Quote
Old 01-25-2018, 10:57 AM   #5
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default

Quote:
Originally Posted by mespotine View Post
This can be done using an external state, that signals "script already running". You would need to change this state again, when ending the " primary" script.

You can set the selection of the "script already running" dialog in the reaper-kb.ini but this change needs a restart in Reaper, that's why you can't change that at runtime.
yes, but the question to the user is redundant and so not necessary and might lead to misunderstandings and errors! so would be nice if the script could be able to decide the method.
deeb is offline   Reply With Quote
Old 01-25-2018, 11:59 AM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

Quote:
Originally Posted by juliansader View Post
This can work if there are two separate scripts, with the primary (non-looping) script starting the secondary (looping) script via OnCommand.

Unfortunately, I don't think it will work with single scripts: AFAIK, REAPER pops up the dialog box *before* starting the script, so the script does not get the chance to check extstates.
It works in the same script as well:

check, if the state is set to "running"
if yes, stop the script (using goto and a label right at the end of the script)
if not, set it to "running" and run the script
When the script is ended, reset the external-state to "not running"

I've done this already in the past successfully...
Meo-Ada Mespotine is online now   Reply With Quote
Old 01-27-2018, 12:18 PM   #7
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

Quote:
Originally Posted by deeb View Post
yes, but the question to the user is redundant and so not necessary and might lead to misunderstandings and errors! so would be nice if the script could be able to decide the method.
Maybe it would be a great idea, if the devs would set "New Instance" as standard behavior and add the option of showing the Terminate-Instance-dialog into the preferences for ReaScripts.
This could hide away the dialog from standard users and developers could work with that behavior of Reaper.

But yeah, we need more comfort when workign with defer-scripts and the said dialog....
Meo-Ada Mespotine is online now   Reply With Quote
Old 01-27-2018, 12:54 PM   #8
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by mespotine View Post
It works in the same script as well:

check, if the state is set to "running"
if yes, stop the script (using goto and a label right at the end of the script)
if not, set it to "running" and run the script
When the script is ended, reset the external-state to "not running"

I've done this already in the past successfully...
Unfortunately I still don't completely understand how this would work. Could you perhaps upload a code snippet to illustrate?

I have tried something like this before, but as mentioned above, REAPER pops up the dialog before the scripts starts to run, so it doesn't avoid the popup:
Code:
function loop()
    if reaper.GetExtState("test terminate", "state") == "must quit" then 
        reaper.DeleteExtState("test terminate", "state")
        return 
    else
        reaper.ShowConsoleMsg("\nStill running...")
        reaper.defer(loop)
    end
end

-----------------------------------------------------
state = reaper.GetExtState("test terminate", "state")
reaper.ShowConsoleMsg("\nState = " .. state)
if state == "running" then 
    reaper.SetExtState("test terminate", "state", "must quit", false)
    return
else
    reaper.SetExtState("test terminate", "state", "running", false)
end
loop()
juliansader is offline   Reply With Quote
Old 01-27-2018, 01:29 PM   #9
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default

Quote:
Originally Posted by mespotine View Post
Maybe it would be a great idea, if the devs would set "New Instance" as standard behavior and add the option of showing the Terminate-Instance-dialog into the preferences for ReaScripts.
i don't know! i assume both are usable: new instance and same instance

maybe it could be an argument of the action and if not declared ask to the user as it is now.

there is a request for: Action Accept Arguments
https://forum.cockos.com/showthread.php?t=195120
deeb is offline   Reply With Quote
Old 01-28-2018, 07:06 PM   #10
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by juliansader View Post
At present, when a deferred (looped) script is already running in the background when its shortcut is pressed again, REAPER pops up the following window:



New users can easily be confused by this popup, and if "Remember my answer" is checked, it is tricky to correct an incorrect answer.

Since script authors typically know beforehand whether their scripts should terminate or re-launch, I suggest that scripts should be able the answer the question themselves.

Perhaps the defer or runloop functions should gain an optional extra boolean or integer parameter, to indicate whether the script should automatically terminate or re-launch:

Code:
reaper.defer(function name or anonymous function definition, optional boolean terminateOptional)
Great idea!
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 05-23-2018, 12:16 AM   #11
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Whenever REAPER gets compared to other DAWs, as in the current VI-Control thread Cubase vs Reaper for composing. Is the grass greener?, the discussion will inevitably turn to the power of ReaScripts, but then equally inevitably, some potential user will complain that using scripts seems too "left brain".

Small touches like removing the popup window and letting scripts themselves decide whether to automatically terminate or not, will make scripts seem less intimidating.

Last edited by juliansader; 05-23-2018 at 12:43 AM.
juliansader is offline   Reply With Quote
Old 05-31-2018, 02:36 AM   #12
Vagelis
Human being with feelings
 
Vagelis's Avatar
 
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 3,799
Default

+1 this would help users a lot.
Vagelis is online now   Reply With Quote
Old 08-19-2018, 09:52 AM   #13
Luster
Human being with feelings
 
Luster's Avatar
 
Join Date: Nov 2015
Posts: 642
Default

+1 from my side

Coming from the MIDI wrap tool thread, were scripts acting like mouse modifier actions - this would make a lot of sense.
Luster is offline   Reply With Quote
Old 04-02-2020, 07:17 AM   #14
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

Maybe one batch script could be run at startup to go over the kb.ini file and set them all in one shot?
lexaproductions is online now   Reply With Quote
Old 04-02-2020, 03:30 PM   #15
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

Would require a restart of Reaper before these changes are accepted.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 04-02-2020, 03:39 PM   #16
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

I wouldn’t mind that. You run the batch once then restart and be done with it.
lexaproductions is online now   Reply With Quote
Old 04-02-2020, 05:44 PM   #17
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

I would prefer this to be doable without Reaper restarting.

But if that's ok for you anyway, I suggest you to read my kb.ini-docs.
Everything you need to alter it with a little string substitution and patternmatching.
https://mespotin.uber.space/Ultrasch...#Reaper-kb.ini

It's actually the first value after SCR that must be altered:

Quote:
SCR a b ActionCommandID "ScriptDescription*" Scriptname.lua|.py

a - leave it at 4 or one of the numbers below, as most other number makes this script unrunnable, though other settings seem to have an effect, though useless when the script doesn't run. 1 consolidate undo points, 2 show in Actions-Menu, 3 consolidate undo points AND show in Actions Menu, 4 shows a "Instance already running"-dialog-window(standardsetting), 200 and above (mostly) makes the entry disappear in Reaper and within the Reaper-kb.ini, if the file is rewritten by Reaper.

4 - Dialogwindow appears(Terminate, New Instance, Abort), if another instance of a given script is started, that's already running

260 - always Terminate All(!) Instances, if you try to run another instance of a script, that's already running. When no instance is running, it simply starts the script.

516 - always start a New Instance of the script, that's already running
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 04-02-2020, 09:12 PM   #18
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

Thanks man.
I literally spend my days in on your site. The info is of great value to me.
lexaproductions is online now   Reply With Quote
Old 04-03-2020, 08:58 AM   #19
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

Quote:
Originally Posted by lexaproductions View Post
Thanks man.
AHHH!!

Quote:
Signature:
Pronounce me with she/her, when referencing me, please. Thanks
Quote:
Originally Posted by lexaproductions View Post
I literally spend my days in on your site. The info is of great value to me.
Cool My Ultraschall-API features access to kb.ini-functions as well, but I haven't tested them good enough yet to be sure, that they allow doing your task.
But you may want to take a look anyways.

Search for "Reaper-kb.ini" in the functions-reference:
https://mespotin.uber.space/Ultrasch...Functions.html
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 04-04-2020, 05:36 AM   #20
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 4,171
Default

I would love an easy way to re-launch a script from within the scripts code - that would ignore whatever setting had been set for the script. This would be incredibly useful.
__________________
Projects - Reascripts - Lua:
Smart Knobs 2 | LBX Stripper | LBX Floating FX Positioner
Donate via Paypal | LBX Tools Website
lb0 is offline   Reply With Quote
Old 04-04-2020, 06:01 AM   #21
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,241
Default

+1 from me too
I have some scripts that are intended to be used as a single instance only and some scripts that have to be multi instanced, and I cannot expect the user to know at first which button to click when launching a new instance.
heda is offline   Reply With Quote
Old 04-04-2020, 10:29 AM   #22
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

+1

I'm greeted with e.g. this several times a day (as it's set to auto launch on new project):


(If 'Cancel' would be remembered that'd help here too.
https://forum.cockos.com/showthread.php?t=210297)
nofish is offline   Reply With Quote
Old 04-04-2020, 12:21 PM   #23
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,417
Default

Quote:
Originally Posted by nofish View Post
+1

I'm greeted with e.g. this several times a day (as it's set to auto launch on new project):


(If 'Cancel' would be remembered that'd help here too.
https://forum.cockos.com/showthread.php?t=210297)
When I get this dialog, it is almost always because the running script GUI is hidden behind Reapers window. I almost never want either to terminate or launch a new, I want to be able to access the running one.

So I am missing a fourth button there with something like: "Bring active script to front".
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 04-04-2020, 12:55 PM   #24
pandabot
Human being with feelings
 
pandabot's Avatar
 
Join Date: Oct 2018
Posts: 367
Default

+1

Yeah it would be cool if the script just regained focus with this behavior specified in the code somewhere. I always just terminate it and then hit the shortcut again to bring it back up because it's quicker than sifting through all the open windows
pandabot is offline   Reply With Quote
Old 04-04-2020, 04:07 PM   #25
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by juliansader View Post
Perhaps the defer or runloop functions should gain an optional extra boolean or integer parameter, to indicate whether the script should automatically terminate or re-launch:
[EDIT: Not boolean, since we actually need a third option too: ignore (cancel).]

Code:
reaper.defer(function name or anonymous function definition, optional boolean terminateOptional)
+1111111
Edgemeal is offline   Reply With Quote
Old 04-04-2020, 06:28 PM   #26
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

So let's get the things together a little, we currently have as an idea for an additional parameter of defer:


Code:
boolean retval = reaper.defer(function func, integer instance_state)

parameters:
function func - the function that shall be deferred
integer instance_state - what to do, when a deferred script is run multiple times
                         nil or 0, ask the user(current behavior)
                         1, terminate instance
                         2, start new instance
                         3, cancel/don't ask and ignore starting 
                            another instance while script is running
                         4, cancel current instance and start 
                            a new one right away
                         &256, commit this as persistant state to reaper-kb.ini as well
                               aka the remember-checkbox
The latter, so we can set them once and they are kept after restart of Reaper, which can be helpful as well.


Edit: It's funny to see, what my arguments were at the beginning of the thread and how I changed my pov over time on that and completely agree with Julian now on that one

Edit2: added option 4, as requested by lb0
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 04-06-2020 at 05:16 AM.
Meo-Ada Mespotine is online now   Reply With Quote
Old 04-06-2020, 02:19 AM   #27
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 4,171
Default

Quote:
Originally Posted by mespotine View Post
So let's get the things together a little, we currently have as an idea for an additional parameter of defer:


Code:
boolean retval = reaper.defer(function func, integer instance_state)

parameters:
function func - the function that shall be deferred
integer instance_state - what to do, when a deferred script is run multiple times
                         nil or 0, ask the user(current behavior)
                         1, terminate instance
                         2, start new instance
                         3, cancel/don't ask and ignore starting 
                            another instance while script is running
                         &256, commit this as persistant state to reaper-kb.ini as well
                               aka the remember-checkbox
The latter, so we can set them once and they are kept after restart of Reaper, which can be helpful as well.


Edit: It's funny to see, what my arguments were at the beginning of the thread and how I changed my pov over time on that and completely agree with Julian now on that one
Does this include an option to terminate the current instance and start a new instance?

I guess by choosing option 2 - and then quitting the current instance would achieve this - or even choosing terminate instance and then in the atexit code running a new instance - but wanted to be sure this case was covered (as both of these cases could be seen as a little ambiguous).
__________________
Projects - Reascripts - Lua:
Smart Knobs 2 | LBX Stripper | LBX Floating FX Positioner
Donate via Paypal | LBX Tools Website
lb0 is offline   Reply With Quote
Old 04-06-2020, 05:13 AM   #28
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

No, as the options reflected the current behavior, but I'll put it into the suggestion as well, as this sounds really useful.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 04-07-2020, 05:38 AM   #29
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

I vote for this FR too.

For the moment, a hack for this problem could be this:
Code:
Pseudo code:

- check ExtState if value is set
- if yes, then continue with script code
- if no, then open reaper-kb.ini and set the appropriate value for the script for "terminate" or "new instance". Set ExtState value to OK and then automatically exit and reopen script
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 04-07-2020, 08:51 AM   #30
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

Quote:
Originally Posted by amagalma View Post
I vote for this FR too.

For the moment, a hack for this problem could be this:
Code:
Pseudo code:

- check ExtState if value is set
- if yes, then continue with script code
- if no, then open reaper-kb.ini and set the appropriate value for the script for "terminate" or "new instance". Set ExtState value to OK and then automatically exit and reopen script
The hack wouldn't work. Kb.ini is only read when starting Reaper, so any changes will only take effect after restart of Reaper, not just the script.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 04-07-2020, 10:52 AM   #31
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by mespotine View Post
The hack wouldn't work. Kb.ini is only read when starting Reaper, so any changes will only take effect after restart of Reaper, not just the script.

Oh


Even if a dummy script was added and removed with AddRemoveReaScript?
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 04-07-2020, 10:57 AM   #32
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

No. Reaper would add the dummyscript to the kb.ini but not read its contents again.
See it this way: while Reaper is running, the kb.ini is more a notefile for Reaper to keep track of the actions/shortcuts it currently internally handles for later reference during restart.

I spend days and days to trigger rereading the kb.ini but to no avail.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 04-07-2020, 04:26 PM   #33
wfd
Human being with feelings
 
Join Date: Nov 2016
Posts: 37
Default

"New users can easily be confused by this popup, and if "Remember my answer" is checked, it is tricky to correct an incorrect answer."

Sorry if I am hijacking this topic, but can someone point me in the direction of fixing such a mistake as Juliansader pointed out.

Im my case I ran the SPK77 midi velocity tool and clicked new instance, and now of course I have bags of new instances running.

How can I remove this?

Have looked for the text in BBEdit in a number of files but couldn;t find it.

If there is already a post on this just point me.
Thanks[/QUOTE]
wfd is offline   Reply With Quote
Old 04-07-2020, 04:38 PM   #34
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

Go into the actions-menu and click on each running instance. You should be able to stop them this way.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 04-07-2020, 04:43 PM   #35
wfd
Human being with feelings
 
Join Date: Nov 2016
Posts: 37
Default

Quote:
Originally Posted by mespotine View Post
Go into the actions-menu and click on each running instance. You should be able to stop them this way.
Thanks for the reply but perhaps I misunderstand you.

I wish to UNDO the mistake of clicking the 'remember this action' button so that I don't get multiple instance opening.

Sure I can just close each instance by hitting the 'X' (close) button, but that defeats the purpose.

Plus the actions menu only has one instance, even if I have ten open.
wfd is offline   Reply With Quote
Old 04-07-2020, 04:46 PM   #36
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

@wfd

If you made the wrong choice in that pop up and clicked 'remember my answer' you can delete the script from action list and import it again to get that pop up again.
nofish is offline   Reply With Quote
Old 04-07-2020, 04:50 PM   #37
wfd
Human being with feelings
 
Join Date: Nov 2016
Posts: 37
Default

Quote:
Originally Posted by nofish View Post
@wfd

If you made the wrong choice in that pop up and clicked 'remember my answer' you can delete the script from action list and import it again to get that pop up again.
Thanks no fish, I tried that but there must be another place it is recalling the command.

I'll do it once more just to check.

EDIT: Yep that worked. I think the first time I tried uninstalling it using the REaPACK packages folder.

Anyway--thanks
wfd is offline   Reply With Quote
Old 04-07-2020, 04:51 PM   #38
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

Ok, the easiest way would be removing it from the actionlist and readding it. Though I don't know, if there would be possible problems with ReaPack.

The more advanced way would be editing the Reaper-Kb.ini, in which these settings are stored.

First, make a copy of the Reaper-Kb.ini just in case, you accidentally make a mistake.
Then open the original file.
Look for the SCR line, which holds the same ActionCommandID as the script in the actionlist.
Exchange the first number after SCR with a 4. Save it and restart Reaper.

Now you can choose again.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 06-28-2020, 12:07 PM   #39
justcosmic1
Human being with feelings
 
Join Date: Dec 2013
Posts: 109
Default Temporary work arounds within scripts..?

OK I am a bit out of my depth here....but...

I just had a script kindly made for me in the script request thread https://forum.cockos.com/showthread....64#post2311064
(Thanks to Edgemeal and some input from Nofish)
And I ran into the deferred scripts thing too...

I noticed that scripts like mine have a "Function Toolbar" section and a "Function Main" section.
So I wondered there might be an oportunity to write a section inbetween something like the follwing (in laymens terms sorry!):
"if deferred scripts window opens, choose "__" then continue script, else continue script"

If this were possible would this then partly cover the option mentioned above to cease all running instances and then immediately start a new instance ?

I realise that as some of this is above my programming knowledge - but my logical design sense tells me that in the case of scripts initiated by buttons, it appears that the first part of the script is already running; hence my suggestion.
If however I have got that wrong; then is there a similar temporary work around by breaking out the first part of the script plust the "if deferred window" or "if is running "[script name]" (to pre-empt that window)?
The idea of the later, is that it could easily be edited/adapted for any scripts. It's not quite as neat as having it embedded all in one script - but at least it would give an easy to add template for script makers to use and then distribute their scripts as a packaged action.
Or does this end up being a cycle action (& presumably much less efficient) ?
justcosmic1 is offline   Reply With Quote
Old 06-28-2020, 01:06 PM   #40
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

This is independent of it. If you run the deferrable-script from toolbar a second time, the dialog should still pop up.

There's no chance currently to prevent that from happening from the script, only if the user chooses from the dialog and checks the remember-checkbox.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine 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 07:48 AM.


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