Old 02-22-2018, 02:14 PM   #1
James Slanger
Human being with feelings
 
Join Date: Feb 2018
Posts: 24
Default "Copy File..." Project Bay context menu item

New to the API and trying to script the Copy File function. Can someone point me in the right direction?
James Slanger is offline   Reply With Quote
Old 02-22-2018, 04:05 PM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Could you please describe what you want to do in more detail? What are you trying to make what exactly and for what purpose?
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-22-2018, 05:03 PM   #3
James Slanger
Human being with feelings
 
Join Date: Feb 2018
Posts: 24
Default

Thanks for the reply. Posting this during a lull in a session, hence the brevity.

My goal is to be able to export a portion of a previously recorded item while recording something new. I can split and glue the portion I want and Right Click - Copy File.. from the Project Bay. Trying to do this with a time selection and a script.

Edit to add: My use case is during a long-format broadcast. I briefly drop out of record during commercial breaks to start new files for each segment. While the current segment is recording, I need to export smaller portions of the previous segment to a location on a network drive.

Last edited by James Slanger; 02-22-2018 at 05:33 PM.
James Slanger is offline   Reply With Quote
Old 02-22-2018, 10:18 PM   #4
James Slanger
Human being with feelings
 
Join Date: Feb 2018
Posts: 24
Default

Can the Media folder for a project be set via ReaScript? I'm not yet finding that in the API.

Thinking about:

Store current Media folder path
Set Media folder path to Export folder
Glue item based on timeline selection
Revert Media folder path

One concern is what happens when the Media path changes while in record.

-Jim
James Slanger is offline   Reply With Quote
Old 03-01-2018, 07:56 PM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

You can only switch between the primary and the secondary recording path using the Api, as far as I remember...

Have you thought about locating the files you want to export and then copying them in the background via the shell-command "copy".
You can do this using BR_Win32_ShellExecute or ExecProcess. There are some differences in detail in how these functions work, so you need to check out in detail, which one works better for you.

The biggest problem to solve is, which of the items you want to export. Their accompanying audio-filenames can be gotten with GetMediaItemTake_Source and GetMediaSourceFileName (in that order).
After that, copy them using ExecProcess to the folder you want...

This is, how I would do it probably...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-15-2018, 11:12 AM   #6
James Slanger
Human being with feelings
 
Join Date: Feb 2018
Posts: 24
Default

mespotine -
Here's what I cobbled together:

Code:
local item = reaper.GetSelectedMediaItem(0, 0)
local take = reaper.GetActiveTake(item)
local source = reaper.GetMediaItemTake_Source(take)
local filename = reaper.GetMediaSourceFileName(source, "")
os.execute(string.format('cp "%s" ~/Documents/Reaper-Exports', filename))
Is there a way to create a new preference or project setting for the destination folder and have a script reference that?

-Jim
James Slanger 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 11:32 PM.


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