Old 07-06-2019, 10:44 AM   #1
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default not finding actions i need for custom action (region selection)

i'm trying to make a template project that would have a track with a series of regions, overlapping, of standard lengths. the custom action would have many variants, each corresponding to a region. that would allow me to pick an action and it would cut material from my stock track based on region length. in other words i would have a 1 sec action, a 2 sec action, a 3 sec action, etc and by running any one of those i could grab the appropriate length of material. i'm not finding the actions to select regions, though.

i do see actions to select regions 1-4 but that's all. i might have many more than that.

what i'm ultimately trying to do here is to have a template project that has content on track 1 and additional content on track 3. there would be a series of defined, overlapping regions (this is because the track 3 content might not be long enough to cover all of the regions). there would be an action for each region. by running an action, i'd be able to grab a chunk of a specific length from the track 3 content and paste it into track 1 at a given point.

i'm not seeing the tools to accomplish this in either the standard actions or reapack so far, though. thought folks here would likely be better informed than me as to how to go about this, hopefully, using existing actions/scripts.

thanks for any thoughts and i hope this is clear,
babag
babag is offline   Reply With Quote
Old 07-08-2019, 10:40 AM   #2
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

just got a response in the tips and tricks forum that somewhat addresses this, though, not in the best way:

https://forum.cockos.com/showthread.php?t=222760

apparently i can edit the S&M.ini file to get more than the default 4 region selection actions. that's helpful but it would still be much better to be able to make an action that selects a region by name. is that really not possible?

thanks,
babag
babag is offline   Reply With Quote
Old 07-08-2019, 10:46 AM   #3
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,028
Default

It's probably scriptable.

Does selecting a region just set the time selection?
Lokasenna is online now   Reply With Quote
Old 07-08-2019, 11:11 AM   #4
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

thanks lokasenna. yes, i wanted to select predefined regions in order to set a time selection. after that i would split an item at that time selection, copy it, then paste it somewhere. for now, though, i just eed to be able to select the region by name so i can make the split. i think i can get through the rest of it if i can make the region selection.

thanks again,
babag
babag is offline   Reply With Quote
Old 07-08-2019, 11:20 AM   #5
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,028
Default

If nobody else beats me to it I'll give it a go when I get home from work.
Lokasenna is online now   Reply With Quote
Old 07-08-2019, 12:09 PM   #6
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

cool!
babag is offline   Reply With Quote
Old 07-08-2019, 01:13 PM   #7
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

and, just to hopefully keep things simple, i'll say that i wasn't looking for anything as complex as user input. i was hoping to find an action or script that had the region name hard coded into it. figured i'd just make duplicate scripts and change the region name in each one. that way i could assign each to a toolbar button.

thanks again,
babag
babag is offline   Reply With Quote
Old 07-08-2019, 03:06 PM   #8
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

this was just posted by MusoBob in the tips and tricks forum:
Code:
region_name = "verse" -- the region name I need to go to

count_markers_regions, count_markersOut, count_regionsOut = reaper.CountProjectMarkers(0)

      for i = 0, count_regionsOut do
        
        iRetval, bIsrgnOut, iPosOut, iRgnendOut, NameOut, iMarkrgnindexnumberOut, ColorOut = reaper.EnumProjectMarkers3(0,i)

        if region_name == NameOut then
          reaper.SetEditCurPos(iPosOut, 0, 0)
          break 
        end
      end
hopefully does the trick but i won't get to test it out till i get back to the studio tonight.

babag
babag is offline   Reply With Quote
Old 07-08-2019, 08:39 PM   #9
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

the above code sets the edit cursor to the start of the named region rather than selecting the named region. is there a command to can change to make it select the region?

thanks,
babag
babag is offline   Reply With Quote
Old 07-09-2019, 05:57 AM   #10
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,028
Default

Replace the line that says reaper.SetEditCurPos with this:
Code:
regionStart, regionEnd = reaper.GetSet_LoopTimeRange(true, false, iPosOut, iRgnendOut, true)
This will set Reaper's time selection to that region.

If you want to set the loop points instead (which is what double-clicking a region does), change the false on that line to true. If you want to set the loop points AND the time selection, duplicate the line and just it on one of them.
Lokasenna is online now   Reply With Quote
Old 07-09-2019, 09:58 AM   #11
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

thanks so much, lokasenna. not sure what this means, though:

"just it on one of them."

thanks again,
babag
babag is offline   Reply With Quote
Old 07-09-2019, 10:19 AM   #12
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,028
Default

Sorry, that should have said "just change it on one of them" - to do both the time selection and loop points, you would want one with false and one with true.
Lokasenna is online now   Reply With Quote
Old 07-09-2019, 10:31 AM   #13
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

hmm. just made the change and ran the script but the region still doesn't seem to select.

maybe doesn't matter but, when i click a region in the region manager it indicates it is selected by the region boundaries changing from rounded to squared. that doesn't happen when i run this.

i do want to make a time selection at some point in what i'm doing, i'm just wondering what's up with selection. is it selected but just not showing it? is it not selected? this seems to jump from finding the region to making a time selection without ever selecting the region itself.

like i say, it may not matter but curious since my logical process when thinking about what i wanted to try to do assumed selection of the region.

thanks again,
babag
babag is offline   Reply With Quote
Old 07-09-2019, 10:32 AM   #14
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

Quote:
Originally Posted by Lokasenna View Post
Sorry, that should have said "just change it on one of them" - to do both the time selection and loop points, you would want one with false and one with true.
AH! that makes sense now. thanks!
babag is offline   Reply With Quote
Old 07-09-2019, 10:39 AM   #15
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,028
Default

Quote:
Originally Posted by babag View Post
this seems to jump from finding the region to making a time selection without ever selecting the region itself.
Correct. I didn't actually realize that regions themselves could be selected - I thought it was just changing the loop points when you double-clicked one.

At any rate the script API doesn't give us a way to select regions, so if you actually need that part I think you're out of luck.
Lokasenna is online now   Reply With Quote
Old 07-09-2019, 10:42 AM   #16
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,609
Default

thanks so much for the clarification. now i can stop thinking about it. like i said, i really need the time selection and you've given me that. if the api doesn't allow for selection i'll just stop thinking about it!

thanks again,
babag
babag 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 09:00 AM.


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