@Billg95222
There is no need to script this, the action works. Here is the code directly recorded without including the filename, the same as the action in my previous screenshot:
#target photoshop
(function () {
// Set the output folder
var outputFolder = Folder.selectDialog("Please select the folder to export the video to...");
if (outputFolder === null) {
//alert('Script cancelled!');
return;
}
var idexport = stringIDToTypeID("export");
var desc252 = new ActionDescriptor();
var idusing = stringIDToTypeID("using");
var desc253 = new ActionDescriptor();
var iddirectory = stringIDToTypeID("directory");
desc253.putPath(iddirectory, new File( outputFolder ));
var idameFormatName = stringIDToTypeID("ameFormatName");
desc253.putString(idameFormatName, """H.264""");
var idamePresetName = stringIDToTypeID("amePresetName");
desc253.putString(idamePresetName, """1_High Quality.epr""");
var iduseDocumentSize = stringIDToTypeID("useDocumentSize");
desc253.putBoolean(iduseDocumentSize, true);
var iduseDocumentFrameRate = stringIDToTypeID("useDocumentFrameRate");
desc253.putBoolean(iduseDocumentFrameRate, true);
var idpixelAspectRatio = stringIDToTypeID("pixelAspectRatio");
var idpixelAspectRatio = stringIDToTypeID("pixelAspectRatio");
var iddocument = stringIDToTypeID("document");
desc253.putEnumerated(idpixelAspectRatio, idpixelAspectRatio, iddocument);
var idfieldOrder = stringIDToTypeID("fieldOrder");
var idvideoField = stringIDToTypeID("videoField");
var idpreset = stringIDToTypeID("preset");
desc253.putEnumerated(idfieldOrder, idvideoField, idpreset);
var idmanage = stringIDToTypeID("manage");
desc253.putBoolean(idmanage, true);
var idallFrames = stringIDToTypeID("allFrames");
desc253.putBoolean(idallFrames, true);
var idrenderAlpha = stringIDToTypeID("renderAlpha");
var idalphaRendering = stringIDToTypeID("alphaRendering");
var idnone = stringIDToTypeID("none");
desc253.putEnumerated(idrenderAlpha, idalphaRendering, idnone);
var idvideoExport = stringIDToTypeID("videoExport");
desc252.putObject(idusing, idvideoExport, desc253);
executeAction(idexport, desc252, DialogModes.NO);
}());
Compare this with the filename step recorded as per my previous action screenshot, where I have replaced the hard-coded name with the current document name:
#target photoshop
(function () {
// Set the output folder
var outputFolder = Folder.selectDialog("Please select the folder to export the video to...");
if (outputFolder === null) {
//alert('Script cancelled!');
return;
}
var idexport = stringIDToTypeID( "export" );
var desc279 = new ActionDescriptor();
var idusing = stringIDToTypeID( "using" );
var desc280 = new ActionDescriptor();
var iddirectory = stringIDToTypeID( "directory" );
desc280.putPath( iddirectory, new File( outputFolder ) );
var idname = stringIDToTypeID( "name" );
desc280.putString( idname, app.activeDocument.name.replace(/\.[^\.]+$/, '') );
var idameFormatName = stringIDToTypeID( "ameFormatName" );
desc280.putString( idameFormatName, """H.264""" );
var idamePresetName = stringIDToTypeID( "amePresetName" );
desc280.putString( idamePresetName, """1_High Quality.epr""" );
var iduseDocumentSize = stringIDToTypeID( "useDocumentSize" );
desc280.putBoolean( iduseDocumentSize, true );
var iduseDocumentFrameRate = stringIDToTypeID( "useDocumentFrameRate" );
desc280.putBoolean( iduseDocumentFrameRate, true );
var idpixelAspectRatio = stringIDToTypeID( "pixelAspectRatio" );
var idpixelAspectRatio = stringIDToTypeID( "pixelAspectRatio" );
var iddocument = stringIDToTypeID( "document" );
desc280.putEnumerated( idpixelAspectRatio, idpixelAspectRatio, iddocument );
var idfieldOrder = stringIDToTypeID( "fieldOrder" );
var idvideoField = stringIDToTypeID( "videoField" );
var idpreset = stringIDToTypeID( "preset" );
desc280.putEnumerated( idfieldOrder, idvideoField, idpreset );
var idmanage = stringIDToTypeID( "manage" );
desc280.putBoolean( idmanage, true );
var idallFrames = stringIDToTypeID( "allFrames" );
desc280.putBoolean( idallFrames, true );
var idrenderAlpha = stringIDToTypeID( "renderAlpha" );
var idalphaRendering = stringIDToTypeID( "alphaRendering" );
var idnone = stringIDToTypeID( "none" );
desc280.putEnumerated( idrenderAlpha, idalphaRendering, idnone );
var idvideoExport = stringIDToTypeID( "videoExport" );
desc279.putObject( idusing, idvideoExport, desc280 );
executeAction( idexport, desc279, DialogModes.NO );
}());
Both scripts produce the same result, the active document name is used.
An extra block of code would need to be added to check for an existing file and ask whether you wish to overwrite or not.
... View more