-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathCutLeft.lua
More file actions
47 lines (39 loc) · 1.22 KB
/
CutLeft.lua
File metadata and controls
47 lines (39 loc) · 1.22 KB
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
38
39
40
41
42
43
44
45
46
47
-- @noindex
-- Global variables --
item = reaper.GetSelectedMediaItem(0,0);
itemLength = reaper.GetMediaItemInfo_Value(item,"D_LENGTH");
itemPosition = reaper.GetMediaItemInfo_Value(item,"D_POSITION");
cursorPosition = reaper.GetCursorPosition();
refreshUI = true;
----------------------------------------------------------------------
function Reverse()
reaper.Main_OnCommand(41051,0);
end
----------------------------------------------------------------------
function Cut()
local refrshUI = false;
reaper.SetMediaItemLength(item, right, refreshUI);
end
----------------------------------------------------------------------
function MoveToCursor()
reaper.SetMediaItemPosition(item, cursorPosition, refreshUI);
end
----------------------------------------------------------------------
function Operations()
itemEnd = itemPosition + itemLength;
right = itemEnd - cursorPosition;
end
----------------------------------------------------------------------
-- Main Function --
function CutLeft()
reaper.Undo_BeginBlock()
Operations();
Reverse();
Cut();
Reverse();
MoveToCursor();
reaper.Undo_EndBlock("Cut Left",0)
end
----------------------------------------------------------------------
-- Action --
CutLeft();