|
| 1 | +-- @description Move items to subproject, prompt for name (non-destructive glue) |
| 2 | +-- @author smandrap |
| 3 | +-- @version 1.0 |
| 4 | +-- @noindex |
| 5 | +-- @donation https://paypal.me/smandrap |
| 6 | +-- @about |
| 7 | +-- Does what it says. Requires SWS. |
| 8 | +-- @readme_skip |
| 9 | + |
| 10 | + |
| 11 | +PREFIX_PROJECT_NAME = false |
| 12 | +USE_SUBFOLDER = false |
| 13 | + |
| 14 | +local LABEL = 'SubProject' |
| 15 | +local SUBFOLDER = 'SubProjects' |
| 16 | + |
| 17 | +if reaper.CountSelectedTracks(0) == 0 then return end |
| 18 | + |
| 19 | +local swsok = false |
| 20 | +if not reaper.CF_GetSWSVersion then |
| 21 | + reaper.MB("This script requires SWS extensions", "SWS REQUIRED", 0) |
| 22 | +end |
| 23 | + |
| 24 | +local function main() |
| 25 | + local rec_path = select(2, reaper.GetSetProjectInfo_String(0, 'RECORD_PATH', '', false)) |
| 26 | + local _, rec_filename = reaper.get_config_var_string('recfile_wildcards') |
| 27 | + |
| 28 | + local rv, LABEL = reaper.GetUserInputs('Move items to subproject', 1, 'extrawidth=100,Name:', LABEL) |
| 29 | + if rv then |
| 30 | + reaper.SNM_SetStringConfigVar('recfile_wildcards', PREFIX_PROJECT_NAME and '$project - 'or ''..LABEL) |
| 31 | + |
| 32 | + if USE_SUBFOLDER then reaper.GetSetProjectInfo_String(0, 'RECORD_PATH', SUBFOLDER, true) end |
| 33 | + reaper.Main_OnCommand(41997, 0) |
| 34 | + reaper.GetSetProjectInfo_String(0, 'RECORD_PATH', rec_path, true) |
| 35 | + |
| 36 | + if swsok then reaper.SNM_SetStringConfigVar('recfile_wildcards', rec_filename) end |
| 37 | + end |
| 38 | +end |
| 39 | + |
| 40 | + |
| 41 | +reaper.Undo_BeginBlock() |
| 42 | +main() |
| 43 | +reaper.Undo_EndBlock('Move tracks to subproject, prompt for name', 0) |
0 commit comments