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

Thread Tools Display Modes
Old 07-21-2019, 03:19 PM   #1
Human being with feelings
Join Date: Dec 2017
Posts: 97
Default Reascript API: Wait until MainOnCommand Action finishes before continuing script

Having an issue with one of my scripts and I believe it is because the script is continuing before a subproject render action is completed. It seems like an asynchronous code issue, because it will only happen sometimes and occurs more often on a faster computer/clean install of Reaper.

I would love to have a way to call an action, but check that it has finished before continuing in the script, so I could remove erratic behavior from my script.
Nostrap is offline   Reply With Quote
Old 07-22-2019, 05:33 AM   #2
Human being with feelings
nofish's Avatar
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,050

I had a similar issue when trying to read a render queue file which was just saved previously via API.
I think the saving also happens asynchronously, so sometimes it got 'missed' reading it back.
What I did was continously check in a loop if the file actually exists and only then continue the script.
Not sure if such a way is applicable in your situation.

Anyway I think some sort of notify /waiting mechanism as you suggest would be helpful in such cases indeed.
nofish is offline   Reply With Quote
Old 07-22-2019, 07:53 AM   #3
Human being with feelings
mespotine's Avatar
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,558


I had numerous usecases over time who would have benefitted massively from that.
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 07-22-2019, 09:36 AM   #4
Human being with feelings
Lokasenna's Avatar
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,251


If a true "wait" command is impractical, a simple workaround might be for Reaper to store a name and timestamp somewhere whenever it completes i.e. a render operation, so scripts can poll that file to see when the command is finished.
Lokasenna is offline   Reply With Quote
Old 07-22-2019, 10:07 AM   #5
Human being with feelings
nappies's Avatar
Join Date: Dec 2017
Posts: 130

+1 from me
nappies is online now   Reply With Quote
Old 07-22-2019, 04:43 PM   #6
Human being with feelings
Join Date: Dec 2011
Posts: 495


I ran into a case where I really need this.
Alkamist is offline   Reply With Quote
Old 07-26-2019, 05:05 AM   #7
Human being with feelings
Travesty's Avatar
Join Date: Nov 2014
Posts: 506


yes please
Travesty is offline   Reply With Quote

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 06:45 PM.

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