Old 05-26-2015, 11:50 AM   #1
syntetic
Human being with feelings
 
syntetic's Avatar
 
Join Date: May 2014
Posts: 160
Default Scripts for copying items ,(EEL)

Can come in handy if we use same sample on all track,for layering audio items for example.
Paste snapshot of selected items


PHP Code:
cpos=getCursorPosition();
main_oncommand(40698,0);
main_oncommand(41173,0);
Main_OnCommand(NamedCommandLookup("_XENAKIOS_SELFIRSTITEMSOFTRACKS"),0);
item GetSelectedMediaItem(0,0);
take GetActiveTake(item);
src1 GetMediaItemTake_Source(take);
GetSetMediaItemTakeInfo_String(take"P_NAME"#takename, 0);
filename GetMediaSourceFileName(src1#filenamebuf);
Main_OnCommand(NamedCommandLookup("_SWS_DELALLITEMS"),0);
main_oncommand(40058,0);
i=0;
loop(CountSelectedMediaItems(0),
(
item GetSelectedMediaItem(0,i);
take GetActiveTake(item);
src PCM_Source_CreateFromFile(#filenamebuf);
SetMediaItemTake_Source(takesrc);
GetSetMediaItemTakeInfo_String(take"P_NAME"#takename, 1);
);
+= 1;
UpdateArrange();
);
SetEditCurPos(cpos,0,0);
main_oncommand(40289,0);
main_oncommand(40048,0); 
Paste snapshot of selected items without delete


PHP Code:
cpos=getCursorPosition();main_oncommand(40698,0);
main_oncommand(40698,0);
main_oncommand(41173,0);
Main_OnCommand(NamedCommandLookup("_XENAKIOS_SELFIRSTITEMSOFTRACKS"),0);
item GetSelectedMediaItem(0,0);
take GetActiveTake(item);
src1 GetMediaItemTake_Source(take);
GetSetMediaItemTakeInfo_String(take"P_NAME"#takename, 0);
filename GetMediaSourceFileName(src1#filenamebuf);
main_oncommand(40058,0);
i=0;
loop(CountSelectedMediaItems(0),
(
item GetSelectedMediaItem(0,i);
take GetActiveTake(item);
src PCM_Source_CreateFromFile(#filenamebuf);
SetMediaItemTake_Source(takesrc);
GetSetMediaItemTakeInfo_String(take"P_NAME"#takename, 1);
);
+= 1;
UpdateArrange();
);
SetEditCurPos(cpos,0,0);
main_oncommand(40289,0);
main_oncommand(40048,0); 

Last edited by syntetic; 05-26-2015 at 01:13 PM.
syntetic is offline   Reply With Quote
Old 05-26-2015, 12:09 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,700
Default

Hi !

Thank you for sharing :P

You may consider storing cursor pos inside a variable, using the Get Cursor Position function in the API, so that it doesn't overwrittte the br_slot that the user may used for other reason.

--

You may also consider copy pasting using this function:
Quote:
bool ApplyNudge(ReaProject project, int nudgeflag, int nudgewhat, int nudgeunits, value, bool reverse, int copies)
some of my scripts were design with copy pasting but this functions could make the think a lot more easier :P

--
One other nice thing will be to make the source items be choosen with Mouse Context rather that "first on selected on track". It will be far more flexible

What do you think of that ?
X-Raym is offline   Reply With Quote
Old 05-26-2015, 01:02 PM   #3
syntetic
Human being with feelings
 
syntetic's Avatar
 
Join Date: May 2014
Posts: 160
Default

updated: get/set cursor position by API

Last edited by syntetic; 05-26-2015 at 01:12 PM.
syntetic is offline   Reply With Quote
Old 05-26-2015, 01:09 PM   #4
syntetic
Human being with feelings
 
syntetic's Avatar
 
Join Date: May 2014
Posts: 160
Default

X-Raym
Hi.
How can i place list of items for selecting source item?
syntetic is offline   Reply With Quote
Old 05-26-2015, 01:23 PM   #5
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,700
Default

@syntetic
What are you trying to do ?

(Note, I may recommand you to take the Lua jump as soon as possible You will have access to more resource about codes, and it is a more user-friendly language as well. You will be able to play more with tables and arrays with it than in EEL).
X-Raym is offline   Reply With Quote
Old 07-13-2015, 12:46 AM   #6
syntetic
Human being with feelings
 
syntetic's Avatar
 
Join Date: May 2014
Posts: 160
Default

X-Raym
Sorry for a delay with the answer.
In the first second I thought about a list of items in the tracks menu,as in the first two scripts ), bad idea

I almost finished script:



but it works correctly only the third time-
i don't know as to make, that state of script was recognized
straight after loading reaper/project
& i have crashes when i try to use BR_SetTakeSourceFromFile
I will upload it later.
syntetic is offline   Reply With Quote
Old 12-19-2015, 07:59 AM   #7
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 4,766
Default

Any progress mate ?
vanhaze 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:46 AM.


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