Copy link to clipboard
Copied
Can someone direct me to a script that can take the file and SaveForWeb in different versions and append different text to the filename?
For example, say I've got a file called "myPhoto". I need a script that saves it as JPEG called "myPhotoPOWERPOINT" and a GIF called "myPhotoWEB"
Is this possible?
Thanks to everyone for your time
Copy link to clipboard
Copied
This script will export the activeDocument as a jpg and gif
function exportSFWJpg( doc, saveFile, qty ) {
var exportOpts = new ExportOptionsSaveForWeb( );
// see guide for other options
exportOpts.format = SaveDocumentType.JPEG
exportOpts.includeProfile = true;//default false
exportOpts.quality = qty;
if ( saveFile.exists ) saveFile.remove( );
doc.exportDocument( saveFile, ExportType.SAVEFORWEB, exportOpts );
}
function exportSFWGif( doc, saveFile, qty ) {
var exportOpts = new ExportOptionsSaveForWeb( );// default format is gif
// see guide for other options
if ( saveFile.exists ) saveFile.remove( );
doc.exportDocument( saveFile, ExportType.SAVEFORWEB, exportOpts );
}
var doc = activeDocument;
var docPath = decodeURI( doc.path );
var docName = decodeURI ( doc.name );
docName = docName.match( /(.*)(\.[^\.]+)/ ) ? docName = docName.match( /(.*)(\.[^\.]+)/ ) : docName = [ docName, docName, undefined ];
var saveName = docName[ 1 ];
exportSFWJpg( doc, new File( docPath + '/' + saveName + 'POWERPOINT.jpg' ), 80 );
exportSFWGif( doc, new File( docPath + '/' + saveName + 'WEB.gif' ) );