Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

script to SaveForWeb with different file name

Community Beginner ,
Aug 05, 2009 Aug 05, 2009

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

TOPICS
Actions and scripting
899
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Aug 05, 2009 Aug 05, 2009
LATEST

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' ) );

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines