ReaScript Lua for REAPER 5
Console
Native IDE
Hellow World
reaper.ShowConsoleMsg("Hello World")
Variable
string = "Hello World"
Break Lines
"\n"
Clean
reaper.ShowConsoleMsg("")
Function
Msg()
Reading Error Message and Variable Types
Language Native Function
tostring()
API Documentation
Auto-Generated
Online
External Code Editor
Working on Selected Items
Get First Selected Item
GetSelectedMediaItem(0, 0)
Get Item Properties
GetMediaItemInfo_Value(MediaItem item, string parmname)
Set Item Properties
SetMediaItemInfo_Value(MediaItem item, string parmname, number newvalue)
Loop in Selected Items
CountSelectedMediaItems(ReaProject proj)
GetSelectedMediaItem(0, i)
Debugging a Loop
Conditions
If then
Propagate Vol
if count_selected_items >= 1 then
br_mouse
Get Time Selection
GetSet_LoopTimeRange2(ReaProject proj, boolean isSet, boolean isLoop, number startOut, number endOut, boolean allowautoseek)
if no time selection
Loop in Selected Tracks
CountSelectedTracks(ReaProject proj)
if > 0
GetSelectedTrack(ReaProject proj, integer seltrackidx)
Loop in Items on Tracks
GetTrackNumMediaItems(MediaTrack tr)
GetTrackMediaItem(MediaTrack tr, integer itemidx)
Break Loops
Item End
Select Items
SetMediaItemSelected(MediaItem item, bool selected)
Native action
Main_OnCommand(40289, 0)
Consider Locked Items
GetMediaItemInfo_Value(MediaItem item, "C_LOCK")
Polishing
Header
Comments
Undo
Undo_BeginBlock()
Undo_EndBlock("Action", -1)
Optimization
PreventUIRefresh(1)
Customization
User Config Area
Show Message Box
Get User Inputs