-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReaScript Template.lua
75 lines (53 loc) · 1.89 KB
/
ReaScript Template.lua
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
--[[
@description
@author Ben Smith
@link
Author https://www.bensmithsound.uk
Repository https://github.com/bsmith96/Reaper-Scripts
@version 1.0
@changelog
+ Initial version
@metapackage
@provides
[main] . > bsmith96_{filename}.lua
@about
# {Package name}
Written by Ben Smith - {Month Year}
### Info
*
### Usage
*
### User customisation
*
]]
-- =========================================================
-- =============== USER CUSTOMISATION AREA ===============
-- =========================================================
--------- End of user customisation area --
-- =========================================================
-- ================= GLOBAL VARIABLES ====================
-- =========================================================
local r = reaper
-- get the script's name and directory
local scriptName = ({r.get_action_context()})[2]:match("([^/\\_]+)%.lua$")
local scriptDirectory = ({r.get_action_context()})[2]:sub(1, ({r.get_action_context()})[2]:find("\\[^\\]*$"))
-- =========================================================
-- ====================== FUNCTIONS ======================
-- =========================================================
-- =========================================================
-- ====================== UTILITIES ======================
-- =========================================================
-- Deliver messages and add new line in console
function dbg(dbg)
r.ShowConsoleMsg(tostring(dbg) .. "\n")
end
-- Deliver messages using message box
function msg(msg, title)
local title = title or scriptName
r.MB(tostring(msg), title, 0)
end
-- =========================================================
-- =================== MAIN ROUTINE ======================
-- =========================================================
r.Undo_BeginBlock()
r.Undo_EndBlock(scriptName, -1)