From 9e8da5064d2bb6d9ada334154ca782cd9054b1bc Mon Sep 17 00:00:00 2001 From: smandrap <60984250+smandrap@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:07:13 +0100 Subject: [PATCH] Update and rename smandrap_Insert new subproject in Subproject folder.lua to smandrap_Move tracks to subprojects, prompt for name.lua --- ...rt new subproject in Subproject folder.lua | 34 --------------- ...tracks to subprojects, prompt for name.lua | 43 +++++++++++++++++++ 2 files changed, 43 insertions(+), 34 deletions(-) delete mode 100644 Subprojects/smandrap_Insert new subproject in Subproject folder.lua create mode 100644 Subprojects/smandrap_Move tracks to subprojects, prompt for name.lua diff --git a/Subprojects/smandrap_Insert new subproject in Subproject folder.lua b/Subprojects/smandrap_Insert new subproject in Subproject folder.lua deleted file mode 100644 index 75d1bd8..0000000 --- a/Subprojects/smandrap_Insert new subproject in Subproject folder.lua +++ /dev/null @@ -1,34 +0,0 @@ --- @description Insert new subproject in Subproject folder (prompt for name) --- @author smandrap --- @version 1.0 --- @noindex --- @donation https://paypal.me/smandrap --- @about --- Does what it says. If SWS is installed, prefix label with "Subproject" --- @readme_skip - - -local LABEL = 'SubProject' -local SUBFOLDER = 'SubProjects' - - -local swsok = false -if reaper.CF_GetSWSVersion then swsok = true end - -local function main() - local rec_path = select(2, reaper.GetSetProjectInfo_String(0, 'RECORD_PATH', '', false)) - local _, rec_filename = reaper.get_config_var_string('recfile_wildcards') - - if swsok then reaper.SNM_SetStringConfigVar('recfile_wildcards', '$project - '..LABEL) end - - reaper.GetSetProjectInfo_String(0, 'RECORD_PATH', SUBFOLDER, true) - reaper.Main_OnCommand(41049, 0) -- Insert Subproject - reaper.GetSetProjectInfo_String(0, 'RECORD_PATH', rec_path, true) - - if swsok then reaper.SNM_SetStringConfigVar('recfile_wildcards', rec_filename) end -end - - -reaper.Undo_BeginBlock() -main() -reaper.Undo_EndBlock('Insert SubProject', 0) diff --git a/Subprojects/smandrap_Move tracks to subprojects, prompt for name.lua b/Subprojects/smandrap_Move tracks to subprojects, prompt for name.lua new file mode 100644 index 0000000..cea9f20 --- /dev/null +++ b/Subprojects/smandrap_Move tracks to subprojects, prompt for name.lua @@ -0,0 +1,43 @@ +-- @description Move tracks to subprojects, prompt for name +-- @author smandrap +-- @version 1.0 +-- @noindex +-- @donation https://paypal.me/smandrap +-- @about +-- Does what it says. Requires SWS. +-- @readme_skip + + +PREFIX_PROJECT_NAME = false +USE_SUBFOLDER = false + +local LABEL = 'SubProject' +local SUBFOLDER = 'SubProjects' + +if reaper.CountSelectedTracks(0) == 0 then return end + +local swsok = false +if not reaper.CF_GetSWSVersion then + reaper.MB("This script requires SWS extensions", "SWS REQUIRED", 0) +end + +local function main() + local rec_path = select(2, reaper.GetSetProjectInfo_String(0, 'RECORD_PATH', '', false)) + local _, rec_filename = reaper.get_config_var_string('recfile_wildcards') + + local rv, LABEL = reaper.GetUserInputs('Move items to subproject', 1, 'extrawidth=100,Name:', LABEL) + if rv then + reaper.SNM_SetStringConfigVar('recfile_wildcards', PREFIX_PROJECT_NAME and '$project - 'or ''..LABEL) + + if USE_SUBFOLDER then reaper.GetSetProjectInfo_String(0, 'RECORD_PATH', SUBFOLDER, true) end + reaper.Main_OnCommand(41997, 0) + reaper.GetSetProjectInfo_String(0, 'RECORD_PATH', rec_path, true) + + if swsok then reaper.SNM_SetStringConfigVar('recfile_wildcards', rec_filename) end + end +end + + +reaper.Undo_BeginBlock() +main() +reaper.Undo_EndBlock('Move tracks to subproject, prompt for name', 0)