Old 10-01-2019, 08:23 AM   #1
Cloudswim
Human being with feelings
 
Join Date: May 2017
Posts: 106
Default paste ITEMS aligning to original item track positions

is there a script for something like this?

every time i copy a bunch of items I have to click on the specific track to where it was initially cut so it will align with the original track position.

Possible to make a script that selects the top track of the items that was copied, then I can make the paste. This essentially will ensure that the pasted contents always align with original track positions.

Would really really appreciate it if someone can help me out with this!

many thanks!
Cloudswim is offline   Reply With Quote
Old 10-01-2019, 09:58 AM   #2
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Oblivion
Posts: 7,101
Default

I do it like:

Copy
Select all tracks with selected items
Select first of selected tracks
Copy items
Save track selection

Paste
Restore saved track selection
Paste items
__________________
Myy Wyyrd Muzyyk
foxAsteria is offline   Reply With Quote
Old 10-01-2019, 11:20 AM   #3
Cloudswim
Human being with feelings
 
Join Date: May 2017
Posts: 106
Default

Quote:
Originally Posted by foxAsteria View Post
I do it like:

Copy
Select all tracks with selected items
Select first of selected tracks
Copy items
Save track selection

Paste
Restore saved track selection
Paste items

I can't find this script -> Select all tracks with selected items

Last edited by Cloudswim; 10-01-2019 at 11:46 AM.
Cloudswim is offline   Reply With Quote
Old 10-01-2019, 06:24 PM   #4
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Oblivion
Posts: 7,101
Default

sorry, it's sws select only track(s) with selected item(s)
__________________
Myy Wyyrd Muzyyk
foxAsteria is offline   Reply With Quote
Old 10-02-2019, 12:42 AM   #5
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 3,107
Default

Yes - fox's solution is neat.

I posted this on the other thread when you asked the question - which would be an alternative:

Code:
local icnt = reaper.CountSelectedMediaItems(0)
local top_track = math.huge
for i = 0, icnt-1 do
  local item = reaper.GetSelectedMediaItem(0, i)
  local track = reaper.GetMediaItem_Track(item)
  local tracknum = reaper.GetMediaTrackInfo_Value(track, 'IP_TRACKNUMBER')
  top_track = math.min(top_track, tracknum-1)
end
if top_track <= reaper.CountTracks(0) then
  --add copy code here if you want it to do the copy/paste automatically
  reaper.SetOnlyTrackSelected(reaper.GetTrack(0, top_track))
  --add paste code here - or simply manually paste when script is done
end
This doesn't do the copy/paste - but that would simply be a case of adding copy/paste actions.

The only advantage of this over fox's I can think of is you can abort the copy/paste should it find no items selected - but there should be no difference in functionality except you aren't telling it to perform any actions needlessly.

Obviously - if you add the paste action - then you'd need to ensure the edit cursor was at the paste location before running the script.
__________________
Projects - Reascripts - Lua:
LBX Stripper | LBX Chaos Engine | LBX Floating FX Positioner | LBX SRD Smart Knobs
Donate via Paypal
lb0 is online now   Reply With Quote
Old 10-02-2019, 01:07 AM   #6
Cloudswim
Human being with feelings
 
Join Date: May 2017
Posts: 106
Default

Quote:
Originally Posted by foxAsteria View Post
sorry, it's sws select only track(s) with selected item(s)
thanks alot for that!
Cloudswim is offline   Reply With Quote
Old 10-02-2019, 07:37 AM   #7
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Oblivion
Posts: 7,101
Default

Quote:
Originally Posted by lb0 View Post
Obviously - if you add the paste action - then you'd need to ensure the edit cursor was at the paste location before running the script.
Mmm, yea you could add some cursor actions too; forgot about that. There should be one to move it to the start of the item selection and store/recall it in the same way as the track selection.

It's probably best we move past custom/cycle actions and use scripts like that whenever possible, since they tend to be more efficient and easy to share. I'm just old school.
__________________
Myy Wyyrd Muzyyk
foxAsteria 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 06:51 AM.


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