简体   繁体   中英

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

Can it even be done?

photoshop script

here's their guide

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

Firstly, it can be done.

Secondly, I agree with Sergey Kritskiy in that if you don't know how to do something, learn how to do it. If you don't want to learn then pay someone a reasonable amount to do it for you.

Don't want to do that? Then at least put in the time and effort to ask a question nicely . - Not all in the the title:)

Okay, you're gonna need three things:

A batch file and a Photoshop Script and a Photoshop Action .

Let's assume that your folder in question is c:\temp

BATCH FILE CD /d C:\temp START.

Save in C:\temp as mybatch.bat

PHOTOSHOP SCRIPT

// 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);
}

Save that as instant_png.jsx in a sensible place (like your Photoshop scripts folder)

In Photoshop, open a flattened image that you want to turn into a png. Record an action (Actions palette, new action) to run a script: When the record button is red, just head over to the file menu File > Scripts > Browse and then find and pick the Photoshop script, instant_png.jsx. HIT THE STOP RECORDING ACTION BUTTON. - Otherwise you just continue to record everything you do in Photoshop. And we don't want that.

Now you have an action that runs a Photoshop script that calls a batch file. :)

Assign a hotkey in Photoshop to that action. And bingo. you're done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM