Old 05-10-2019, 02:15 PM   #1
Susan G
Human being with feelings
 
Susan G's Avatar
 
Join Date: Jul 2008
Location: Putnam County, NY, USA
Posts: 3,916
Default Reposition/move a region

Hi-

I can reposition a marker using the "Markers: Add/move marker 1 to play/edit cursor" action. With AutoHotkey, I can use SendMessage,0x0111,40657,0,,ahk_class REAPERwnd.

I need to be able to reposition a region (without contents) similarly so the start is at the play/edit cursor.

I didn't see anything in the Action List or ReaPack that addressed this, but if I missed it please let me know.

Thanks!

-Susan
Susan G is offline   Reply With Quote
Old 05-11-2019, 03:49 AM   #2
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 779
Default

Have a look in the ReaTrak scripts, there's one for copy selected regions and one for paste.
There's also a function in the chord sheet and circle of fifths to copy and paste regions with or without items. Once you have copied and pasted the regions you can delete the old.

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

EDIT:
ReaTrak Copy project markers and regions in time selection.lua
ReaTrak Paste project markers and regions at edit cursor.lua

https://forum.cockos.com/showthread.php?t=201983#8

Last edited by MusoBob; 05-11-2019 at 03:58 AM.
MusoBob is offline   Reply With Quote
Old 05-11-2019, 07:17 AM   #3
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 14,449
Default

sounds like it would be a good idea to put those region scripts up to ReaPack as thier own things... yes? Especially the one that will move a region without the contents. Please?
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is online now   Reply With Quote
Old 05-11-2019, 08:53 AM   #4
Susan G
Human being with feelings
 
Susan G's Avatar
 
Join Date: Jul 2008
Location: Putnam County, NY, USA
Posts: 3,916
Default

Quote:
Originally Posted by MusoBob View Post
Have a look in the ReaTrak scripts, there's one for copy selected regions and one for paste.
There's also a function in the chord sheet and circle of fifths to copy and paste regions with or without items. Once you have copied and pasted the regions you can delete the old.

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

EDIT:
ReaTrak Copy project markers and regions in time selection.lua
ReaTrak Paste project markers and regions at edit cursor.lua

https://forum.cockos.com/showthread.php?t=201983#8
Those look handy, but wouldn't work for my purpose.

I want the region in question moved so it starts where my cursor is, i.e. just the way the Move Marker works except with a region instead. I don't want to have to change the time selection to select the region first; that would defeat the purpose. In fact, anything that's not as fast as Move Marker wouldn't be worth it.

Thanks!

-Susan
Susan G is offline   Reply With Quote
Old 05-11-2019, 01:31 PM   #5
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 779
Default

Quote:
Originally Posted by hopi View Post
sounds like it would be a good idea to put those region scripts up to ReaPack as thier own things... yes? Especially the one that will move a region without the contents. Please?

You could modify it to move the region number to the cursor position,

or create a new script to get the length and color of the region number in a user input prompt, delete that region then create a new region at the cursor position.



MusoBob is offline   Reply With Quote
Old 05-11-2019, 01:44 PM   #6
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,183
Default

Quote:
Originally Posted by Susan G View Post
Hi-

I can reposition a marker using the "Markers: Add/move marker 1 to play/edit cursor" action. With AutoHotkey, I can use SendMessage,0x0111,40657,0,,ahk_class REAPERwnd.

I need to be able to reposition a region (without contents) similarly so the start is at the play/edit cursor.

I didn't see anything in the Action List or ReaPack that addressed this, but if I missed it please let me know.

Thanks!

-Susan
Hi Susan,
you can just drag the region with ALT key. This won't move contents.
But to automatically position the start to edit cursor, would require a small script I think. But how to tell the script which region do you want to move? I think it is better to just ALT drag the region with snap enabled.
__________________
HeDaScripts for REAPER
heda is offline   Reply With Quote
Old 05-11-2019, 01:59 PM   #7
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 779
Default

This works but you need to enter the region number



Code:
retval_region,region_number  = reaper.GetUserInputs("Region To Move", 1, "Enter Region Number", "")


if not retval_region then goto finish end

retval, isrgn, rgnpos, rgnend, name, markrgnindexnumber, color = reaper.EnumProjectMarkers3(0, region_number-1)

length = (rgnend-rgnpos)

reaper.DeleteProjectMarker(0, region_number, true)

cur_pos = reaper.GetCursorPosition()

reaper.AddProjectMarker2( 0, true, cur_pos, cur_pos+length, name, -1, color )



::finish::

Last edited by MusoBob; 05-11-2019 at 02:16 PM.
MusoBob is offline   Reply With Quote
Old 05-11-2019, 02:54 PM   #8
Susan G
Human being with feelings
 
Susan G's Avatar
 
Join Date: Jul 2008
Location: Putnam County, NY, USA
Posts: 3,916
Default

Quote:
Originally Posted by heda View Post
Hi Susan,
you can just drag the region with ALT key. This won't move contents.
But to automatically position the start to edit cursor, would require a small script I think. But how to tell the script which region do you want to move? I think it is better to just ALT drag the region with snap enabled.
Dragging wouldn't work because I don't want to leave my current cursor position and time selection.

I've already assigned the region a fixed number, so it can be referenced in a script.

Thanks-

-Susan
Susan G is offline   Reply With Quote
Old 05-11-2019, 07:03 PM   #9
Susan G
Human being with feelings
 
Susan G's Avatar
 
Join Date: Jul 2008
Location: Putnam County, NY, USA
Posts: 3,916
Default

Quote:
Originally Posted by MusoBob View Post
This works but you need to enter the region number



Code:
retval_region,region_number  = reaper.GetUserInputs("Region To Move", 1, "Enter Region Number", "")


if not retval_region then goto finish end

retval, isrgn, rgnpos, rgnend, name, markrgnindexnumber, color = reaper.EnumProjectMarkers3(0, region_number-1)

length = (rgnend-rgnpos)

reaper.DeleteProjectMarker(0, region_number, true)

cur_pos = reaper.GetCursorPosition()

reaper.AddProjectMarker2( 0, true, cur_pos, cur_pos+length, name, -1, color )



::finish::
Thanks for this. I'll keep fiddling with it, but I couldn't get it to work. The region I want to move is number 100, which is greater than the last actual region number in the project. Maybe that's part of the problem, but even when I used other numbers, the length of the region was always zero, and neither the name nor color came along.

I want to move Region #100 (or any other fixed number,) which is always 5 seconds long, to the current cursor position without changing the current time selection or cursor position.

Frustrating, because Move Marker works perfectly, so I wish for a Move Region!

Thanks again-

-Susan
Susan G is offline   Reply With Quote
Old 05-11-2019, 08:44 PM   #10
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 779
Default

Try this


Code:
retval_region,region_number  = reaper.GetUserInputs("Region To Move", 1, "Enter Region Number", "")

if not retval_region then goto finish end

retval, num_markers, num_regions = reaper.CountProjectMarkers(0)

  for i = 0 , num_regions -1   do
      retval, isrng, pos, rgnend, name, markrgnindexnumber, color = reaper.EnumProjectMarkers3(0, i)
      
      if tonumber(markrgnindexnumber) == tonumber(region_number) then  
         length = (rgnend-pos)
         reaper.DeleteProjectMarker(0, markrgnindexnumber, true)
         cur_pos = reaper.GetCursorPosition()
         reaper.AddProjectMarker2( 0, true, cur_pos, cur_pos+length, name, region_number, color )
      end
  end

::finish::
MusoBob is offline   Reply With Quote
Old 05-12-2019, 09:06 AM   #11
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 14,449
Default

Thanks Bob... that works nicely!
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is online now   Reply With Quote
Old 05-14-2019, 11:30 AM   #12
Susan G
Human being with feelings
 
Susan G's Avatar
 
Join Date: Jul 2008
Location: Putnam County, NY, USA
Posts: 3,916
Default

Quote:
Originally Posted by MusoBob View Post
Try this
Hi MusoBob-

This works great, thanks!

Note to self, mostly:
I wanted to use a constant for the region number so the script wouldn't require any input. REAPER allows you to set the Region ID manually and originally I'd chosen 100 arbitrarily for my 5 sec Region ID (the one that gets moved.) Once I realized the ID had to be within the index range of the regions in the project, I changed the ID so that it was & the script works like a charm.

This will save me quite a bit of time. Thanks very much again!

-Susan
Susan G 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 02:30 AM.


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