SWS NEEDED
Good morning all,
Here is a script that can be derived in many different ways.
In the example here, it concerns the zoom
how does it work ?
add a keyboard shortcut (for example "z") to the script
when you launch it, a User input window appears
enter a number from 1 to 5 followed by ENTER
1 -> zoom on the item
2 -> zoom on the track
3-> zoom on the time selection
4 -> zoom on the project
5 -> zoom tool
The goal is to have a single shortcut that contains several actions to avoid the use of modifiers not always easy to remember
Script can be duplicated and modified to match another keyshorcut
example "S"
1-> split item at cursor
2-> stretch marker at cursor
3-> split at time selection
4 -> split and crossfade
5 -> split and quantize
If you want to customise the script, just replace the red part of the code to fit your need (action ID must be in "" for custom action, cycle action, sws and script.
Code:
local function act(cmdid)
if type(cmdid) == "string" then
cmdid = reaper.NamedCommandLookup(cmdid)
end
reaper.Main_OnCommand(cmdid, 0)
end
------ USER MOD ------------------------------
action1 = "_SWS_TOGZOOMIONLY" -- zoom to item
action2 = 40113 -- zoom to track
action3 = "_SWS_TOGZOOMHORIZ_TSEL"-- zoom to time selection
action4 = 40295 -- zoom project
action5 = "_SWS_ZOOM" -- zoom tool
-------------------------------------
--------------------------------
function main()
reaper.Undo_BeginBlock()
_, val = reaper.GetUserInputs("Multilayer Shortcut", 1, "Zoom to", "")
if val == "1" then
act (action1)
end
if val == "2" then
act (action2)
end
if val == "3" then
act (action3)
end
if val == "4" then
act (action4)
end
if val == "5" then
act (action5)
end
end
main()
reaper.UpdateArrange()
reaper.Undo_EndBlock("layer zoom", 0)