0
這工作得很好,打開的文件夾Photoshop的腳本 - 路徑變量
#target photoshop
app.bringToFront();
var path = 'C:/PhotoshopPortable/'
// A hard coded path to a directory 'mac style'
var processFolder = Folder('C:/PhotoshopPortable/')
// Use folder object get files function with mask 'a reg ex'
var fileList = processFolder.getFiles(/\.(pdf)$/i);
// Loop through files
for (var i = 0; i < fileList.length; i++) {
// Only process the returned file objects
// The filter 'should' have missed out any folder objects
if (fileList[i] instanceof File && fileList[i].hidden == false) {
// get a reference to the new document
var docRef = open(fileList[i])
// save and close
saveJPEG(new File('C:/PhotoshopPortable/' + app.activeDocument.name + ".jpg"), 12)
app.activeDocument.close();
}
}
function saveJPEG(saveFile, jpegQuality){
var doc = activeDocument;
if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) doc.bitsPerChannel = BitsPerChannelType.EIGHT;
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);
}
在PDF但這不會:
var path = 'C:/PhotoshopPortable/'
var processFolder = Folder(path)
它會打開(Mozilla的???)許可證一些未知文件文本。
我不需要文件夾對話框,我只想在變量中有工作路徑。
嘗試將路徑格式化爲'/ c/folder /' –