Old 05-02-2019, 12:36 AM   #1
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default Undo a Function within a Script

I need to undo a function from within a script ??
MusoBob is offline   Reply With Quote
Old 05-02-2019, 09:58 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Do you mean a script that's like

undo the next function
function functionname()
stop undoing this function

?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-02-2019, 10:02 AM   #3
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

explain it a bit more please


reaper.Undo_BeginBlock2(ReaProject proj)

your function...

reaper.Undo_EndBlock2(ReaProject proj, string descchange, integer extraflags)


I see there is still no documentation for the extraflags
heda is offline   Reply With Quote
Old 05-02-2019, 10:11 AM   #4
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by heda View Post
I see there is still no documentation for the extraflags
It's at the bottom of reaper_plugin.h in the SDK.
cfillion is offline   Reply With Quote
Old 05-02-2019, 10:22 AM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by cfillion View Post
It's at the bottom of reaper_plugin.h in the SDK.
Thanks, will ad that to my docs then
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-02-2019, 01:11 PM   #6
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

I need to split the regions @ tempo markers to fit drums track then after it is fitted put the regions back as they were,
The function can be an internal or call another script, whatever will work.
MusoBob is offline   Reply With Quote
Old 05-02-2019, 01:20 PM   #7
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Do you have a script, that does all the splitting and fitting already?
Because in that case, you just would need to store the regions-information before the splitting.
After everything's done, delete all regions and recreate them with the information you got before.

You could even write two scripts:
1) who somehow store the region's information into extstate
then you do your stuff
2) who recreates the regions from the information stored into an extstate


Much easier than fiddling around with undo, as undo in Reaper has its issues...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-02-2019, 01:26 PM   #8
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Like this


MusoBob is offline   Reply With Quote
Old 05-02-2019, 08:29 PM   #9
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Yes I think save regions then import.
I'm already using the Import one below for this Biab Drums script
and another Chordino chord import thanks to X-Raym !

X-Raym_Import markers and regions from tab-delimited CSV file.lua

X-Raym_Export markers and regions as tab-delimited CSV file.lua

I could call on them in the script, just need to Export to the Scripts\ReaTrak folder
and import from the ReaTrak folder silently in the background so there's no dialogs.
The below is in the Export script can I do way with that and have a set path ?


if not reaper.JS_Dialog_BrowseForSaveFile then
Msg("Please install JS_ReaScript REAPER extension")
else

Last edited by MusoBob; 05-02-2019 at 08:35 PM.
MusoBob is offline   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 05:24 PM.


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