function saveAsPSD(saveFolder) {
    var doc = app.activeDocument; // 获取当前文档

    if (doc == null) {
        alert("没有打开的文档！");
        return;
    }

    var fileName = doc.name.replace(/\.[^\.]+$/, ''); // 移除文件扩展名
    var saveFile = File(saveFolder + "/" + fileName + ".psd"); // 创建保存路径
      
      var d = new ActionDescriptor();
      var d1 = new ActionDescriptor();
        d1.putBoolean(stringIDToTypeID("maximizeCompatibility"), true);
        d.putObject(stringIDToTypeID("as"), stringIDToTypeID("photoshop35Format"), d1);
        d.putPath(stringIDToTypeID("in"), new File(saveFile));
        d.putInteger(stringIDToTypeID("documentID"), 2027);
        d.putBoolean(stringIDToTypeID("lowerCase"), true);
        d.putEnumerated(stringIDToTypeID("saveStage"), stringIDToTypeID("saveStageType"), stringIDToTypeID("saveSucceeded"));
        executeAction(stringIDToTypeID("save"), d, DialogModes.NO);


}

