Old 10-23-2019, 03:59 AM   #1
vengstrom
Human being with feelings
 
Join Date: May 2017
Posts: 6
Default Importing files/folders

I've used reaper 6+ years, but I've yet to find if you can import files automatically (or quicker) in a way that all the sounds in a folder end up on the same track, and that all folders get a separate track. (see gif below)

>>> https://i.imgur.com/3GdZ8DN.gif

I've done this with 4500+ files and I can tell you it's not that fun hehe

Does anyone know of any way to do this quicker/automate it or an addon/extension thing which might help me?
vengstrom is offline   Reply With Quote
Old 10-23-2019, 07:01 AM   #2
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,636
Default

Closest thing that I know of that might make that easier is a Windows app I recently made, latest version posted here. You can drag and drop folders to get all files in the root then click the add button. To do what you really want I'd probably need to add some extra options, like a "favorite files/folders" list to make it easier to load tons of files.
Edgemeal is offline   Reply With Quote
Old 10-23-2019, 07:42 AM   #3
vengstrom
Human being with feelings
 
Join Date: May 2017
Posts: 6
Default

Ah cool! I tried your app just now, I used to flatten the folder structure with "Folder Merger" by 2xdsoft and then just drag/dropping them all into reaper.

But your app sadly does not solve my problem. If you watch the .gif you can see that I'm adding each folder to a new track and not just all files to one track or one file per track.

An idea for your app would be to add the functionality to strip the last characters of filenames (eg. " 01") and add all files with the same name to one track, and then add the next group of files to a new track, etc?

Or split it according to folders? That all files from a folder gets put on one track, and the next folder gets another track with all its files on it etc?
vengstrom is offline   Reply With Quote
Old 10-23-2019, 07:48 AM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,636
Default

Ya currently you have to select the target track before clicking the add button. Seems everyone has their own workflows, I just spent 4 days writing another REAPER util for myself, it never ends! Best of luck!
Edgemeal is offline   Reply With Quote
Old 10-23-2019, 08:14 AM   #5
vengstrom
Human being with feelings
 
Join Date: May 2017
Posts: 6
Default

Thanks!

I've done some C# command line things myself for batching stuff to save time.

Could I mayhaps poke around in your source code and see if I could add the features I'm looking for?
vengstrom is offline   Reply With Quote
Old 10-23-2019, 08:41 AM   #6
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,636
Default

Quote:
Originally Posted by vengstrom View Post
Thanks!

I've done some C# command line things myself for batching stuff to save time.

Could I mayhaps poke around in your source code and see if I could add the features I'm looking for?
The only part you probably need to know then is to how to send files to REAPER from your C# app, I use VB.Net, but hopefully this helps get you started.

Code:
' example syntax from Winform, SendFile(Form1, "C:\drumset1\kick.wav", false)

Private Const WM_COPYDATA As Integer = &H4A
Private Const WM_COMMAND As Integer = &H111

<StructLayout(LayoutKind.Sequential)> _
Private Structure COPYDATASTRUCT
    Public dwData As IntPtr
    Public cbData As Integer
    Public lpData As String
End Structure

<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function SendMessage( _
         ByVal hWnd As HandleRef, _
         ByVal Msg As UInteger, _
         ByVal wParam As IntPtr, _
         ByRef lParam As COPYDATASTRUCT) As Integer
End Function

Public Shared Function SendFile(callingForm As Form, filename As String, Optional newTab As Boolean = False) As Boolean
    Dim hWndReaper As IntPtr = GetWindowHandle("REAPER") ' gets handle to first instance of Reaper.
    If Not hWndReaper.Equals(IntPtr.Zero) Then
        If Not newTab Then filename = "#NOTAB#" & filename
        If Not SendData(callingForm, hWndReaper, filename) Then ' If the receiving app processes this message, it should return TRUE; otherwise, it should return FALSE.
            MessageBox.Show("REAPER failed to process 'Send Media' message!", "Send Data Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Return False
        End If
    Else
        MessageBox.Show("REAPER not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
        Return False
    End If
    Return True
End Function

Private Shared Function SendData(frm As Form, hWnd As IntPtr, lpData As String) As Boolean
    Dim href As New HandleRef(frm, hWnd)
    Dim cds As New COPYDATASTRUCT
    cds.dwData = CType(&H100, IntPtr)
    cds.lpData = lpData & Convert.ToChar(0) ' null terminated string.
    cds.cbData = cds.lpData.Length
    Return SendMessage(href, WM_COPYDATA, frm.Handle, cds) <> 0
End Function

Private Shared Function GetWindowHandle(processName As String) As IntPtr
    ' returns handle of first instance found, else zero.
    Dim p() = Process.GetProcessesByName(processName)
    Return If(p.Length > 0, p(0).MainWindowHandle, IntPtr.Zero)
End Function
If you want to run a REAPER action,
Code:
SendMessage(hWndReaper, WM_COMMAND, 40001, 0) 'Action# 40001 = Track: Insert new track

<DllImport("user32.dll", EntryPoint:="SendMessage")> _
Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Boolean
End Function
An older vb.net project here,
https://stash.reaper.fm/v/36112/Reap...der%20v0.3.zip

Last edited by Edgemeal; 10-23-2019 at 08:53 AM.
Edgemeal is offline   Reply With Quote
Old 10-23-2019, 08:59 AM   #7
vengstrom
Human being with feelings
 
Join Date: May 2017
Posts: 6
Default

Awesome! Thanks
vengstrom 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 01:11 PM.


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