如何为 photoshop 编写脚本以键入快捷方式然后快速导出为 png 并立即打开导出的文件夹?

How to write a script for photoshop to type a shortcut then quick export to png also open the exported folder instantly?

能做到吗?

photoshop 脚本

这是他们的指南

https://www.adobe.com/devnet/photoshop/scripting.html

首先,可以做到。

其次,我同意 Sergey Kritskiy 的观点,如果您不知道如何做某事,请学习如何去做。如果您不想学习,请花合理的钱请人为您学习。

不想那样做?那么至少要投入时间和精力ask a question nicely。 - 并非全部在标题中:)

好的,你需要三样东西:

一个批处理文件和一个Photoshop Script和一个Photoshop Action.

假设您的文件夹是 c:\temp

批处理文件 CD /d C:\temp 开始。

在 C:\temp 中保存为 mybatch.bat

PHOTOSHOP 脚本

// Switch off any dialog boxes
displayDialogs = DialogModes.NO; // OFF 

// variable to where you want to save the png
var myPNG = "C:\temp\my_png.png";


// save out the png
save_as_png(myPNG);


// call the rename batch files
var myBat = new File("C:\temp\mybatch.bat");


// and we now execute the bat file
File(myBat).execute();

// Set Display Dialogs back to normal
displayDialogs = DialogModes.ALL; // NORMAL


function save_as_png(filePath)
{
  // png file options
  var pngFile = new File(filePath);
  pngSaveOptions = new PNGSaveOptions();
  pngSaveOptions.embedColorProfile = true;
  pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
  pngSaveOptions.matte = MatteType.NONE; pngSaveOptions.quality = 1;

  activeDocument.saveAs(pngFile, pngSaveOptions, false, Extension.LOWERCASE);
}

将其另存为 instant_png.jsx 在一个合理的地方(比如你的 Photoshop 脚本文件夹)

在 Photoshop 中,打开要转换为 png 的拼合图像。 将动作(动作调色板,新动作)录制到 运行 脚本: 当录制按钮为红色时,只需转到文件菜单文件 > 脚本 > 浏览,然后找到并选择 Photoshop 脚本 instant_png.jsx。 点击停止录制操作按钮! - 否则你只是继续记录你在 Photoshop 中所做的一切。我们不希望这样。

现在您有一个动作,运行是一个调用批处理文件的 Photoshop 脚本。 :)

在 Photoshop 中为该操作指定一个热键。还有宾果游戏!你完成了。