Guest User

Untitled

a guest
May 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. (function(){
  2.  
  3. //ドキュメントを複製
  4. var copiedDoc = app.activeDocument.duplicate();
  5.  
  6. //処理(レイヤーを統合)
  7. mergeLayers();
  8.  
  9.   //名前をつけて保存
  10. saveSceneAs();
  11.  
  12. // 複製したドキュメントを保存せず閉じる
  13. activeDocument.close(SaveOptions.DONOTSAVECHANGES);
  14.  
  15. //アラート
  16. alert('終わったよ♪');
  17.  
  18. //レイヤーを統合
  19. function mergeLayers() {
  20.  
  21. docObj = activeDocument;
  22. docObj.mergeVisibleLayers();
  23.  
  24. }
  25.  
  26. function saveSceneAs() {
  27.  
  28. //ドキュメント数を調べて、オリジナルのドキュメントナンバーを取得
  29. n = documents.length -2;
  30.  
  31. //オリジナルのドキュメントのパスと名前を取得
  32. var filePath = documents[n].path;
  33. var fileName = documents[n].name.replace(/\.[^\.]+$/, '');
  34.  
  35. //プリフィックスを追加
  36. var fileFullName = filePath + "/" + fileName + "_export";
  37.  
  38. //保存オプション
  39. var psdObj = new File(fileFullName);
  40. var psdOpt = new PhotoshopSaveOptions();
  41.  
  42. psdOpt.alphaChannels = true;
  43. psdOpt.annotations = true;
  44. psdOpt.embedColorProfile = false;
  45. psdOpt.layers = true;
  46. psdOpt.spotColors = false;
  47.  
  48. //名前をつけて保存
  49. activeDocument.saveAs(psdObj, psdOpt, true, Extension.LOWERCASE);
  50.  
  51. }
  52.  
  53. })() ;
Add Comment
Please, Sign In to add comment