gpt-4-0125-preview· openai
Suzhen/CodeChat
give me the shortest answer possible. What reaper lua function can i use to convert a…
- User
give me the shortest answer possible. What reaper lua function can i use to convert a sws action to a command id
- Assistant
SWS_GetCommandID - User
give me another
- Assistant
reaper.NamedCommandLookup - User
same answer length. make a reaper lua script that toggles between _WOL_SETSELENVHDEF (if envelope track height is minimum) and _WOL_SETSELENVHMIN (if envelope track height is not minimum)
- Assistantlua
local cmdID = reaper.NamedCommandLookup("_WOL_SETSELENVHMIN") -- Find command ID for setting min height local state = reaper.GetToggleCommandStateEx(0, cmdID) -- Get current state of the command if state == 0 then reaper.Main_OnCommand(reaper.NamedCommandLookup("_WOL_SETSELENVHDEF"), 0) -- Set to default height else reaper.Main_OnCommand(cmdID, 0) -- Set to minimum height end - User
create a toggle between the two commands i talked about
- Assistantlua
-- Check the current state of the envelope height local env = reaper.GetSelectedEnvelope(0) if not env then return end -- Exit if no envelope is selected local br_env = reaper.BR_EnvAlloc(env, false) local _, _, _, _, _, defaultHeight = reaper.BR_EnvGetProperties(br_env) -- Assuming defaultHeight corresponds to "minimum" for toggling purposes if defaultHeight > 1 then reaper.Main_OnCommand(reaper.NamedCommandLookup("_WOL_SETSELENVHMIN"), 0) -- Set to minimum height else reaper.Main_OnCommand(reaper.NamedCommandLookup("_WOL_SETSELENVHDEF"), 0) -- Set to default height end reaper.BR_EnvFree(br_env, false)