- ReaScript Basics — Interview on REAPER blog / Part-1
- ReaScript Basics — Interview on REAPER blog / Part-2
- How to Learn ReaScript for REAPER
- Useful Tools for REAPER Scripters
- ReaScript: What can we Expect from v5 Pre-Releases?
- Advanced Actions Management: Import and Export Toolbars Buttons linked to Scripts, Change Script Path and Name
- Scripting for REAPER: General Guidelines
- ReaScript Video Tutorial — Part. 1: The Console Output
- ReaScript Video Tutorial — Part. 2: The Api Documentation
- ReaScript Video Tutorial — Part. 3: Get/Set First Selected Item Properties
- ReaScript Video Tutorial — Part. 4: Loop in Selected Items
- ReaScript Video Tutorial — Part. 5: Conditions Basics
- ReaScript Video Tutorial — Part. 6: Time Selection
- ReaScript Video Tutorial — Part. 7: Loop in Items on Selected Tracks
- ReaScript Video Tutorial — Part. 8: Using Native Actions
- ReaScript Video Tutorial — Part. 9: Preventing Bugs
- ReaScripts Templates Repository on GitHub
In this video, we learn
- How to count the selected track number
- How to loop on selected tracks
- How to loop on items on tracks
From a code perspective, you will learn
- How to make a nested loop
- How to break a loop
Let’s go !
Code Snippet:
function Msg(param) reaper.ShowConsoleMsg(tostring(param).."\n") end function Main() reaper.Main_OnCommand(40289, 0) item_mouse, mouse_pos = reaper.BR_ItemAtMouseCursor() if tostring(item_mouse) ~= "userdata: 0000000000000000" then item_mouse_fadeout = reaper.GetMediaItemInfo_Value(item_mouse, "D_FADEOUTLEN") start_time, end_time = reaper.GetSet_LoopTimeRange2(0, false, false, 0, 0, false) if start_time ~= end_time then Action() end end end function Action() count_sel_tracks = reaper.CountSelectedTracks(0) for j = 0, count_sel_tracks - 1 do track = reaper.GetSelectedTrack(0, j) count_items_on_track = reaper.CountTrackMediaItems(track) for i = 0, count_items_on_track - 1 do item = reaper.GetTrackMediaItem(track, i) item_pos = reaper.GetMediaItemInfo_Value(item, "D_POSITION") if item_pos > end_time then break else item_len = reaper.GetMediaItemInfo_Value(item, "D_LENGTH") item_end = item_pos + item_len if (item_pos > start_time and item_pos < end_time) or (item_end > start_time and item_end < end_time) or (item_pos < start_time and item_end > end_time) then reaper.SetMediaItemInfo_Value(item, "D_FADEOUTLEN", item_mouse_fadeout) end end end end reaper.UpdateArrange() end reaper.ShowConsoleMsg("") Main()
Next videos will show you how to use Native Actions right in your script !
Help us translate the subtitles of this video in your language using Amara.org !
- ReaScript Basics — Interview on REAPER blog / Part-1
- ReaScript Basics — Interview on REAPER blog / Part-2
- How to Learn ReaScript for REAPER
- Useful Tools for REAPER Scripters
- ReaScript: What can we Expect from v5 Pre-Releases?
- Advanced Actions Management: Import and Export Toolbars Buttons linked to Scripts, Change Script Path and Name
- Scripting for REAPER: General Guidelines
- ReaScript Video Tutorial — Part. 1: The Console Output
- ReaScript Video Tutorial — Part. 2: The Api Documentation
- ReaScript Video Tutorial — Part. 3: Get/Set First Selected Item Properties
- ReaScript Video Tutorial — Part. 4: Loop in Selected Items
- ReaScript Video Tutorial — Part. 5: Conditions Basics
- ReaScript Video Tutorial — Part. 6: Time Selection
- ReaScript Video Tutorial — Part. 7: Loop in Items on Selected Tracks
- ReaScript Video Tutorial — Part. 8: Using Native Actions
- ReaScript Video Tutorial — Part. 9: Preventing Bugs
- ReaScripts Templates Repository on GitHub