Old 02-14-2020, 06:02 PM   #1
Denys
Human being with feelings
 
Denys's Avatar
 
Join Date: Jan 2011
Location: Tokyo
Posts: 319
Default Select newest region

I was looking for an action allowing to select the last created region (or at least the region with the highest ID) but I couldn't find anything. Does anyone know if such an action exist?


The closest actions I have found are "select previous region" and "select next region".
__________________
Katabui Original Soundtrack
Denys is offline   Reply With Quote
Old 02-16-2020, 04:20 PM   #2
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Try this Lua script
Code:
 retval, num_markers, num_regions = reaper.CountProjectMarkers( 0 )
 
 reaper.GoToRegion( 0, num_regions, false )

 time = reaper.GetCursorPosition()

 markeridxOut, regionidx = reaper.GetLastMarkerAndCurRegion(0, time)
     
 retval, isrgnOut, posOut, rgnendOut, nameOut, markrgnindexnumberOut, colorOut = reaper.EnumProjectMarkers3(0, regionidx)
     
 start_time, end_time = reaper.GetSet_LoopTimeRange(true, true, posOut, rgnendOut, 0)
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 02-22-2020, 05:42 PM   #3
Denys
Human being with feelings
 
Denys's Avatar
 
Join Date: Jan 2011
Location: Tokyo
Posts: 319
Default

Hello MusoBob, this seems to work very well, thank you very much!
This action should definitely be in ReaPack!
__________________
Katabui Original Soundtrack
Denys is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.