使用Javascript在Photoshop中保存文件而没有提示? [英] Using Javascript to save files in Photoshop without a prompt?

查看:242
本文介绍了使用Javascript在Photoshop中保存文件而没有提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个简单的脚本来编辑现有图像.

I am using a simple script to edit an existing image.

无论我做什么,总是会出现一个保存提示.我希望这是100%自动化的.

No matter what I do, a save prompt always comes up. I want this to be 100% automated.

save()给我一个saveAs提示,将其另存为副本. close(SaveOptions.SAVECHANGES)只是给了我一个通用的您要在关闭之前保存吗?"框,我仍然需要选择是". saveAs()与save()一样,不同之处在于我可以关闭复制"选项,但是仍然无济于事.

save() gives me a saveAs prompt to save it as a copy. close(SaveOptions.SAVECHANGES) just gives me a generic "Do you wish to save before closing?" box that I still need to select Yes on. saveAs() gives me the same as save(), except I can toddle the "As copy" option off... but that still doesn't help.

推荐答案

尝试以下方法:

// where fPath is your file path
// jpgSaveOptions.quality controls the quality of the jpeg

// save out the image as jpeg
var jpgFile = new File(fPath);
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 12;

activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);

存在一个已知的Photoshop兼容性问题错误,但我认为不是.

There is a known bug with compatibility issues of Photoshop, but I dodn't think this is it.

仅作记录用途,Photoshop可以使用Applescript,JavaScript或Visual Basic编写脚本

And just for the record Photoshop can be scripted in either Applescript, JavaScript or Visual Basic

这篇关于使用Javascript在Photoshop中保存文件而没有提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆