Old 10-15-2018, 12:16 AM   #1
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default How to copy items only with API?

Since I wanted to creat a script to copy some items from project B to project A, then I found that the action <Copy Items> didn't work when I using the script:

Code:
reaper.Main_OnCommandEx(40057,0,reaper.EnumProjects(1,0))
So I thought that the <Copy Items> action didn't work with the Main_OnCommandEx API

That's I wanna know is there anyway to copy items using API instead of the action?

Last edited by dsyrock; 10-15-2018 at 03:55 AM.
dsyrock is offline   Reply With Quote
Old 10-15-2018, 01:13 PM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

The easy way:

- Change the projecttab to the project, from where you want to copy the items.
- run the action
- change to the other projecttab again, though.

This will visibly change the projecttabs.


The somewhat difficult way:

Get the Project, with the function:
ReaProject retval, string projfn = reaper.EnumProjects(integer idx, string projfn)

Get the MediaItem, with the function:
MediaItem = reaper.GetMediaItem(ReaProject proj, integer itemidx)

or Get the selected MediaItem, with the function:
MediaItem = reaper.GetSelectedMediaItem(ReaProject proj, integer selitem)


This should give you something to work with...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine 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 04:00 PM.


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