1+ --[[
2+ @description Get name of cue from QLab
3+ @author Ben Smith
4+ @link
5+ Author https://www.bensmithsound.uk
6+ Repository https://github.com/bsmith96/Reaper-Scripts
7+ @version 1.0
8+ @changelog
9+ + Initial version
10+ @metapackage
11+ @provides
12+ [main] . > bsmith96_{filename}.lua
13+ @about
14+ # Get cue name from QLab
15+ Written by Ben Smith - May 2025
16+
17+ ### Info
18+ * Using a custom OSC config, this allows you to get the name of the playhead in QLab.
19+ * This will actually be one cue out and really annoying, but should be a proof of concept.
20+
21+ ### Usage
22+ *
23+
24+ ### User customisation
25+ *
26+ ]]
27+
28+
29+ -- =========================================================
30+ -- =============== USER CUSTOMISATION AREA ===============
31+ -- =========================================================
32+
33+ ---- ----- End of user customisation area --
34+
35+
36+ -- =========================================================
37+ -- ================= GLOBAL VARIABLES ====================
38+ -- =========================================================
39+
40+ local r = reaper
41+
42+ -- get the script's name and directory
43+ local scriptName = ({r .get_action_context ()})[2 ]:match (" ([^/\\ _]+)%.lua$" )
44+ local scriptDirectory = ({r .get_action_context ()})[2 ]:sub (1 , ({r .get_action_context ()})[2 ]:find (" \\ [^\\ ]*$" ))
45+ local scriptFolder = scriptDirectory :gsub (scriptName .. " .lua" , " " )
46+
47+
48+ package.path = scriptFolder .. ' ?.lua'
49+
50+ -- Require the osc module
51+ local osc = require (' osc' )
52+
53+ -- debug
54+ -- local msg = osc.get()
55+ -- if msg then
56+ -- reaper.ShowMessageBox("OSC address: " .. msg.address .. ", argument: " .. (msg.arg and msg.arg or "(nil)"), "Info", 0)
57+ -- else
58+ -- reaper.ShowMessageBox("Invalid or no OSC message", "Error", 0)
59+ -- end
60+
61+
62+ -- =========================================================
63+ -- ====================== FUNCTIONS ======================
64+ -- =========================================================
65+
66+ -- =========================================================
67+ -- ====================== UTILITIES ======================
68+ -- =========================================================
69+
70+ -- Deliver messages and add new line in console
71+ function dbg (dbg )
72+ r .ShowConsoleMsg (tostring (dbg ) .. " \n " )
73+ end
74+
75+ -- Deliver messages using message box
76+ function msg (msg , title )
77+ local title = title or scriptName
78+ r .MB (tostring (msg ), title , 0 )
79+ end
80+
81+
82+ -- =========================================================
83+ -- =================== MAIN ROUTINE ======================
84+ -- =========================================================
85+
86+ r .Undo_BeginBlock ()
87+
88+ -- get OSC message
89+ local msg = osc .get ()
90+
91+ -- Create a marker at the current position, with the args of OSC message as the marker name
92+ r .AddProjectMarker (0 ,0 ,r .GetPlayPosition (),0 ,msg .arg ,- 1 )
93+
94+ -- Send OSC message to QLab to request the cue name from cue ID
95+
96+
97+ r .Undo_EndBlock (scriptName , - 1 )
0 commit comments