Skip to content

Instantly share code, notes, and snippets.

@haroldcris
Created April 24, 2020 04:04
Show Gist options
  • Select an option

  • Save haroldcris/8b2ca9617e0780473dce96c1da29dfd9 to your computer and use it in GitHub Desktop.

Select an option

Save haroldcris/8b2ca9617e0780473dce96c1da29dfd9 to your computer and use it in GitHub Desktop.
main();
function main() {
var project = app.project;
var seq = app.project.sequences;
var vTrack = seq[0].videoTracks[0];
var obj = app.project.rootItem.children[2];
// exportSequence (seq[0],"video01.mp4");
// obj.changeMediaPath("C:\\Users\\HaroldCris\\Pictures\\dental.jpg");
// exportSequence (seq[0],"video02.mp4");
// the length of one frame in premiere pro time (comes in handy later)
var frameLength = Time.seconds;
var startTime = 0;
var thisTime = new Time();
thisTime.seconds = parseInt(Time.seconds);
//var lastClip = vTrack.clips[(vTrack.clips.numItems - 1)];
//$.writeln(lastClip.end.seconds);
//vTrack.insertClip(obj, lastClip.end.seconds);
//var fo = searchForBinWithName ("0.jpg");
//$.writeln(fo);
//find item from bin
//var fo = searchInBin('0.jpg');
//$.writeln(fo.name);
app.project.importFiles(["C:\\Users\\HaroldCris\\Pictures\\dental.jpg"]);
}
function exportSequence(seq, filename) {
$.writeln("Encoding...");
seq.exportAsMediaDirect("e:\\temp\\" + filename, "e:\\temp\\preset.epr");
//obj.changeMediaPath("C:\\Users\\HaroldCris\\Pictures\\dental.jpg");
$.writeln("Done");
}
function searchInBin(nameToFind)
{
var deepSearch = function(folder)
{
$.writeln('...searching in ' + folder.name);
for(var i = 0; i < folder.children.numItems; i++)
{
var item = folder.children[i];
$.writeln('...' + item.name);
if(item.type === 2)
{
var newItem = deepSearch(item);
if (newItem) return newItem;
}
if (item.name == nameToFind)
return item;
}
}
return deepSearch(app.project.rootItem);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment