-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathCutRight.lua
More file actions
37 lines (24 loc) · 919 Bytes
/
CutRight.lua
File metadata and controls
37 lines (24 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- @noindex
-- Global variables --
item = reaper.GetSelectedMediaItem(0,0);
itemPosition = reaper.GetMediaItemInfo_Value(item,"D_POSITION");
cursorPosition = reaper.GetCursorPosition();
refreshUI = true;
----------------------------------------------------------------------------------------------------------------------
function Operations()
itemStart = itemPosition;
left = cursorPosition - itemStart;
end
function Cut()
local refrshUI = false;
reaper.SetMediaItemLength(item, left, refreshUI); -- resize the item to the length of "left" by cutting "right".
end
----------------------------------------------------------------------------------------------------------------------
-- Main Function --
function CutRight()
Operations();
Cut();
end
----------------------------------------------------------------------------------------------------------------------
-- Action --
CutRight();