2012-10-09 68 views
1

在我的JavaScript,在Windows 7中,Photoshop CS2的&的Photoshop CS5,它抛出一个错误:Photoshop中的JavaScript保存错误8800

Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
- Could not save a copy as "C:...\wcb-010B-11Y.jpg" because the file could not be found.
Line: 458
-> docRef.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);

这里是代码的一个总结,保存图片:

var selectedSaveDir = "~/Desktop/"; 
var sFileNamePreFix = "wcb-"; 
var docRef = app.activeDocument; 
var docName = app.activeDocument.name; 
var docNewName = docName.substr(0, docName.length - 4); // strip file extension 
var sNewDocName = sFileNamePreFix + docNewName + ".jpg" 
var sNewFileName = selectedSaveDir + sNewDocName; 
//alert("sNewFileName = " + sNewFileName);  // test to verify correct location 
var saveFile = new File(sNewFileName); 
jpgSaveOptions = new JPEGSaveOptions(); 
jpgSaveOptions.quality = 12; 
docRef.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE); 

在Windows XP中,此脚本在CS2中运行良好,没有问题....只是在Windows 7中,使用CS2或CS5时出现此问题。

该问题似乎类似于:Photoshop Javascript scripting saving and closing document 但我不知道他的操作系统。

我已经添加了“警报(”并确认保存文件夹&名称是正确的,并可以保存到,但同样的问题。

难道是一个UAC的问题在Windows 7?你怎么解决这个问题我已经关闭了所有的UAC设置(我想我做到了正确的),但它仍然发生

任何帮助

回答

0

你错过了?。?“变种docRef = app.activeDocument;”(其我已经添加了);但除此之外,在CS2中,该脚本将jpeg保存到桌面(wcb-text test.jpg)。很明显,但是您是否确保图像平整? r不包含无法存储在jpeg中的任何信息 - 例如,路径。

尝试强制储蓄

//flatten the image 
docRef.flatten(); 

另一件事尝试之前压扁是将文件保存到另一个目录。我知道长文件名(尤其是空格)会导致问题 - 我认为文件路径中有300个字符的限制。