Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Saving in Actions - Help/Suggestions Needed

Status
Not open for further replies.

grinnz

Technical User
Aug 20, 2006
11
US
I’m trying to build a simple action that resizes the open image, saves the resulting smaller image optimized as a specific filename (folder.jpg) in the same folder as the original, and then close the original without saving. The resize and the close steps are done. That’s the easy part. I also have the step built that uses the Save for Web command and it properly names the file to folder.jpg yet the step always wants to save the file into the directory that has been recorded. I would like that the file be saved into the same directory where it found the opened graphic even if I need to open each image individually and manually initiate the action. Is this possible?

As a matter of note, I have also tried to use Imageready and run into the same problem of file naming and saving along with the fact that I simply cannot automate the close image step.

Any help or guidance in this matter is greatly appreciated. I have nearly 3000 images on which to perform this operation.
 
A script would do this.
But having 3000 documents with the SAME NAME (fofder.jpg)
seems very strange!
Anyway here's some code for the save. Tested on CS2.

Code:
var docRef = app.activeDocument; 
saveFile = new File(docRef.path + "/folder.jpg"); 
SaveJpeg(saveFile,8);
function SaveJpeg(jpgFile, jpegQuality){
docRef.flatten();
jpgSaveOptions = new JPEGSaveOptions()
jpgSaveOptions.embedColorProfile = true
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE
jpgSaveOptions.matte = MatteType.NONE
jpgSaveOptions.quality = jpegQuality
app.activeDocument.saveAs(jpgFile, jpgSaveOptions, true,Extension.LOWERCASE)
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top