Copy link to clipboard
Copied
Hi Mathias,
The attached script is a combination of scripts you've helped me with in previous posts. It does the following to selected clips:
-Renames and modifies audio channels of clips with certain file names
-Imports a new copy of one file (2mix)
-Creates a new bin and moves the original 2mix to that bin (this is to temporarily protect it from the next change)
-Renames and modifies audio channels of the new 2mix
-Lays all tracks into the timeline in their assigned places
I want to go further with this script. In particular, move the original 2mix back into its original bin and delete that new, temp bin.
The issue is, after renaming the files, the script gets tripped up on any further action because it can't find the files that were selected.
I'm wondering how to resolve that error so I can continue with the script.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I wrote a function here which does the following:
It imports a footage file into a given target bin and returns the project item of it.
If there exists already an item with the same name in that target bin, the function renames the newly imported item such that it always has a unique name. To achieve that, the function first imports the file into a temporary bin and then renames it if needed before moving it to its final destination.
Using the function is very easy, just give it the file it should import and the bin where it should go:
The implementation is a bit tricky. In a nutshell then renaming a file "oldname.mp4" inside a bin "\bin\subbin" to "newname.mp4", after renaming the variable of the project item still points to
\bin\subbin\oldname.mp4
which does not exist anymore.
Hence, you have to create the string
\bin\subbin\newname.mp4
manually and assign it to the project item, in order to still be able to access it.
Code is attached.