Hi folks,
Perhaps a solution for this already existed, but I couldn't find it. Maybe everyone who needs such a thing is already a competent enough programmer that they don't need such a basic script.
I was looking for a script to save the current ripple mode, and then another script to load that saved mode. To rephrase for SEO: get and set ripple state.
With these two scripts, I could then bookend a custom action, so that it could change ripple for its needs and then restore it to whatever mode it was before the action ran.
I hope you may find this useful. Maybe you'll be able to install them through ReaPack soon, but you can also use the following code to make your own .Lua ReaScript
https://github.com/bowlneudel/ReaScr...4d983cb644ea72
Code:
-- @description Save ripple mode to persistent ExtState
-- @author mendel
-- @version 1.0
-- @about
-- # Save ripple mode to persistent ExtState
--
-- A most basic script that simply gets the current ripple mode, and saves it as a persistent ExtState. This state may be recalled by another script, and the ripple mode restored.
--
-- These two scripts are intended to be used in conjunction: as bookends to custom actions that require a programmatic change of the ripple mode.
Ra = reaper.GetToggleCommandState(41991)
R1 = reaper.GetToggleCommandState(41990)
function Save_Ripple_State()
if Ra==1 then
reaper.SetExtState("Ripple","RippleState","A",1)
-- reaper.ShowMessageBox("Ripple Mode Saved: All Tracks", "Ripple Mode", 0)
end
if R1==1 then
reaper.SetExtState("Ripple","RippleState","P",1)
-- reaper.ShowMessageBox("Ripple Mode Saved: Per Track", "Ripple Mode", 0)
end
if Ra+R1==0 then
reaper.SetExtState("Ripple","RippleState","N",1)
-- reaper.ShowMessageBox("Ripple Mode Saved: Off", "Ripple Mode", 0)
end
end
Save_Ripple_State()
---
https://github.com/bowlneudel/ReaScr...e2352eb736adff
Code:
-- @description Restore ripple mode from persistent ExtState
-- @author mendel
-- @version 1.0
-- @about
-- # Restore ripple mode from persistent ExtState
--
-- This script works in conjunction with "Save ripple mode to persistent ExtState". These two scripts are intended to be used as bookends for custom actions which change the ripple mode programatically. This allows a custom action to proceed as expected, leaving the user experience of the ripple mode unchanged.
function Restore_Ripple_State()
RippleState = reaper.GetExtState("Ripple","RippleState")
if RippleState=="A"
then
reaper.Main_OnCommand(40311,0,1)
-- reaper.ShowMessageBox("Ripple Mode Restored: All Tracks", "Ripple Mode", 0)
end
if RippleState=="P"
then
reaper.Main_OnCommand(40310,0,1)
-- reaper.ShowMessageBox("Ripple Mode Restored: Per Track", "Ripple Mode", 0)
end
if RippleState=="N"
then
reaper.Main_OnCommand(40309,0,1)
-- reaper.ShowMessageBox("Ripple Mode Restored: Off", "Ripple Mode", 0)
end
end
Restore_Ripple_State()