Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all 12244 articles
Browse latest View live

CC2018 Crashing With My Script

$
0
0

I am trying to run the Silver Efex Pro from a script. It used to work fine until I upgraded to CC2018 but now Photoshop crashes and I am baffled as to why.

 

Can anyone see any reason.

 

#target photoshop
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };

//==================== sep ==============
function sep() {
  // Silver Efex Pro 2  function step1(enabled, withDialog) {    if (enabled != undefined && !enabled)      return;    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);    executeAction(sTID('com.niksoftware.sep2.ps'), undefined, dialogMode);  };  step1();      // Silver Efex Pro 2
};

sep.main = function () {
  sep();
};
sep.main();

Script for deleting Hidden Layers which are not used in any Layer Comp?

$
0
0

Hello.

 

I've turend the web upside down searching for a script that would do the following:

 

  1. Search through all the layer comps in the document
  2. Check which layers are hidden on all Layer Comps
  3. Remove/mark with color the layers found.

 

If anybody can provide a script that would do such a thing - it would be highly appreciated.

 

Regards,

Fade.

About progress bar and Photoshop

$
0
0

I have been reading a lot about how to make a progress bar in photoshop (scripting) and my conclusion is that it is not worthy. The only way to make a progress bar is by using Palette window but Photoshop does not support it. If we use a dialog window, since it is modal, it will freeze whatever your script is doing so, you cannot use it (how to track the progress of a script if the script is paused while the dialog is being shown?). Although Photoshop does not support Palette, there are two workarounds that would make it work and they are using either app.refresh() or waitForRedraw() (and undocumented function that seems to me to do exactly the same thing that app.refresh() does). But as the manual says, app.refresh() will slow down considerably your code. According to my experimentation, each time you call app-refresh(), your script will waste about 1 second (no matter how powerful your computer is). That is a lot of time! In practical terms, you would use app.refresh() only a few times so your progress bar could be refreshed only a few times during the whole duration of your script, still one second lost for each time you use it. In other words, there is no good way of making a progress bar in photoshop scripting.

 

My question is: am I right? Is there a way to code a progress bar in PS that would not delay the code unreasonably?

Watch Folder

$
0
0

Hello,

 

Is there a way to have Photoshop watch a folder for new images and run some actions on the newly added files - after which removing the original from that folder.

 

I need to automate the follwoing:

Image is added to watch folder

Photoshop

  1. Detects new image
  2. Opens image
  3. Runs actions
  4. Saves to a new directory

File is deleted from watch folder.

 

I am on Mac 10.7 and have Automator at my disposal. I'm also familiar with scripting but not specifically for Photoshop so I prefer scripting would be the last resort.

 

Any help or guidance is greatly appreciated.

 

Thank you!

 

V

Script Alert: "Sorry I could not process the following files" (Error Message using Image Processor)

$
0
0

I'm a seasoned Photoshop/Bridge CS5 user who recently upgraded to CS6.  In Bridge I just ran my first Image Processor batch, trying to convert a set of RAW .NEF files to .PSD files with a basic editing action I created applied to them.  Photoshop CS6 opens the files from Bridge and applies the actions, but then I get the "Script alert" error message "Sorry I could not process the following files" and a list of all of the files in the batch I was trying to run the script on.  The files all remain open and are saved on my hard drive in a folder created by the Image Processor script, but do not close unless I manually close them.  I never had this problem in CS5 where the image processor would apply the desired actions to the batch of photos one at a time, then save and close.  Thoughts on how I can fix this bug?

Action that can read and put metadata from CSV file?

$
0
0

HI,

 

I just need to create an action that do:

 

1) read 1st column of CSV file

2) find the file named the same as the test in the 1st field of CSV

3) insert all column data into the appropriate meta field

then save the psd file

4) export same psd file as a JPG and PNG while maintaining the meta info

 

Is this something that Photoshop can do that?

 

Thanks in advance!

Executing Sub-Action of Action in Photoshop via Script

$
0
0

Hello everyone!

 

I write script for animating of my work's process.

 

So, idea is simple:

I record my brush strokes with Actions. When work is done I execute script which calls these Actions and after each several brush strokes Photoshop exports numbered image for further video editing.

 

At the moment I found only app.doAction("Action", "Action Set") command for Adobe ExtendScript Toolkit which executes whole action at once without controlling of subactions.

 

Could you tell me, please, is there any command like app.doAction.doSubAction("SubAction", "Action", "Action Set") for executing suboperations of Action?

 

For example, I want to export state of the painting after every 10 brush strokes inside certain Action. I need script something like this:

 

var steps = 1000;

var j = 0;

var index = 0;

 

for (i=1; i < steps; i++)

{

     app.doAction.doSubAction(nextSubAction, "Action", "Action Set");

     j++;

     if (j == 9)

     {

          jpgFile = new File("d:/frame" + '0000'.substr(String(i).length) + index + ".jpg");

         saveOptions = new JPEGSaveOptions();

         saveOptions.embedColorProfile = true;

         saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;

         saveOptions.matte = MatteType.NONE;

         saveOptions.quality = 12;

         app.activeDocument.saveAs(jpgFile, saveOptions, true, Extension.LOWERCASE);

 

         j = 0;

         index ++;

     }

}

Console Output

$
0
0

Is there a something like a  "Trace" statement for the JavaScript console in the ExtendScript Toolkit so I can output the value of variables to the console?  I'm using some alert boxes but that's kina'  clunky.   Thanks.


How can get and set x , y position of opend image ?

$
0
0

Hi,

 

I used photoshop scripting in back end.

I  am using javascript.

 

Here i do following step for image adding in layer.

1. Create main window for save psd file.

2. Create new layer in this window i.e. layer1.
3. Open image in separate new window.
4. Copy image from this window.
5. Set focus (back) in main window and i layer1.
6. Past image here.

 

Here my image is always set on center of layer1.
And i want to set image in given x,y position in layer1

 

Is any one help me so i can set this pasted image in given x,y position in layer1 ?

 

Thanks,
Mohit.

Script to Create Folders Using Photoshop Scripting Mac/Windows

$
0
0

Can anyone help me. I want to create a script to create folders and run the script in Photoshop.

 

I am a real novice at scripting and I do not know if this can be done.

 

Thanks

A script for "Save for Web" as .jpg

$
0
0

I found a script that saves the current selected document in Photoshop as .png to the Desktop, and use it all the time.

 

function main() {

          // declare local variables

          var doc = app.activeDocument;

          var docName = app.activeDocument.name.slice(0,-4);

 

 

    var saveFile = new File("~/Desktop/" + docName + ".png");

    pngSaveOptions = new PNGSaveOptions();

    pngSaveOptions.interlaced = false;

    doc.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);

}

 

main();

 

 

Now I'd really like a similar script to do "Save for Web" as .jpg files, without a colour profile, to the Desktop. Preferably a version to save as 100% quality and one to save as 60% quality.

Any help would be greatly appreciated.

Passing arguments to the jsx file from command line

$
0
0
Thanks for taking my question.

I am using the following to be able to run my script from the command line.In case you were wondering on why i would be doing this- i would need to invoke the javascript from a server side code(like java,php etc. in my case it is java)

"c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx"

Anyways, i have been successful in running the myscript.jsx from the command line but i am not able to figure out how i could pass arguments to "myscript.jsx" from the command line, and be able to refer to these arguments within the script.

I have tried the following

"c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx" "argument1" "argument2"

and tried to refer these arguments within the script using arguments[0] and arguments[1] . But looks like this does not work.

Any thoughts?????

Script to open the Open Dialog Window

$
0
0

Hello everyone!

I'm new to scripting and this is probably an easy question but I'm trying to write a script that opens the Open Dialog Window. Basically I need to start the script in one active document, have the script open the Open Dialog (to let the user select another image) and then finish the script in the newly opened document. Every script I find is to open a specific file, but I need it to be User Selected through the Open Dialog of Photoshop.

 

I hope that makes sense! LOL. Any help would be greatly appreciated!

 

Thanks,

Bradi

Structure of "Brush Stroke" action for exporting to the script

$
0
0

Hello everyone!

After some search on the forums about Adobe Photoshop scripting I found that there is a problem of exporting "Use brush" (Brush Stroke) action to the JavaScript file.

 

I tried on myself ActionFileToXML.jsx and ActionFileToJavascript.jsx from http://ps-scripts.sourceforge.net/xtools.html after recording some brush strokes via Action Palette, and Photoshop became "frozen".

(When I used "Fill" tool without any brush strokes - saved action file converted without problem)

 

I also tried Convert Actions File from http://www.tonton-pixel.com/scripts/utility-scripts/convert-actions-file/index.html . Result was the same.

Without recording brush strokes .atn action file converts without problem, but if I try to export action file with recorded brush strokes application becomes "frozen".

 

I tried to open converted files in the destination folder in hope that they will have brush strokes actions converted to the script - but there was FAIL. This did not happen.

 

-----

 

I did some research of this theme and found that .atn files can be viewed via Freeware Hex Editor XVI32 from http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm

And I found that simple action file with commands Set Foreground Color (red) - Fill

im002.JPG

will become this:

im001.JPG

 

And another simple action file with commands Set Foreground Color (red) - Fill - Set Foreground Color (yellow) - Select brush - Set current brush - Use brush

im003.JPG

will become this:

im004.JPG

Please, pay your attention to the right scrollbar, file is really huge.

Action Set - No Brush.atn takes only 1 KB, and Action Set - Brush.atn - 7 423 KB.

 

 

I make assumption that this big data is about speed of drawing of the line, pressure of the pen on the tablet, direction of the drawing in each millisecond and so on.

 

 

So my question - how to decode this data into the JavaScript? Maybe someone from you, dear users, knows how to operate with such low-level data for further scripting.

In fact, Photoshop somehow understands .atn files and can play "Use brush" commands. So, the solution really exists!

 

Could you help me, please?

Layer Comps to JPG Save for Web

$
0
0

Hello everyone,

 

I'm using the "Layer comp to files" script a lot to send some designs to clients. And sometimes I need to send a lot of JPGs at once, wich are created with "Layer comps to files", but they are all around 300k or more, and when I use Safe for web it reduces the file size a lot! But I don't want todo it all manually again offcourse.

 

So I was wondering, is there any script what saves your Layer Comps JPGs to a JPG what is compressed with the Save for Web technology?

 

Thanks in advance.

 

 

Jeroen


Export Layers to Files: How to keep canvas size

$
0
0

Hello

 

I need to export hundreds of layers to PNG-Files.

Unfortunately the Script crops to the layer's boundary so every file has different dimensions. How to keep the canvas size of the PSD in the exported files?

 

Thanks for your help

 

PS-Version: MacOS, CS 5.1

Close ALL - No Save

$
0
0

Alt+Ctrl+W  closes all documents if a modification was made a warning shows up asking to save or no.

My action "Close All-No Save" takes care of this but the action was written for 8 documents then if only 4 documents are open and playing the action

the dialog Continue or Stop shows up and one must click Stop.

Can a script close all open documents without saving regardless how many are open. An action would call the script and the clicking on the Stop in the dialog

would be not required.

I know not a big deal to click on stop but if it can be avoided why not?

create a folder in presets/scripts

$
0
0

I would like to create a test folder

in this path

photoshop presets/scripts

 

I have this piece of code but it's okay

I use photoshop cc2014 and 2017

 

//Folder to create on the desktop

 

var folder1 = Folder("~/Presets/Scripts/test");

//Check if it exist, if not create it.

if(!folder1.exists) folder1.create();

Watch Folder

$
0
0

Hello,

 

Is there a way to have Photoshop watch a folder for new images and run some actions on the newly added files - after which removing the original from that folder.

 

I need to automate the follwoing:

Image is added to watch folder

Photoshop

  1. Detects new image
  2. Opens image
  3. Runs actions
  4. Saves to a new directory

File is deleted from watch folder.

 

I am on Mac 10.7 and have Automator at my disposal. I'm also familiar with scripting but not specifically for Photoshop so I prefer scripting would be the last resort.

 

Any help or guidance is greatly appreciated.

 

Thank you!

 

V

Script Alert: "Sorry I could not process the following files" (Error Message using Image Processor)

$
0
0

I'm a seasoned Photoshop/Bridge CS5 user who recently upgraded to CS6.  In Bridge I just ran my first Image Processor batch, trying to convert a set of RAW .NEF files to .PSD files with a basic editing action I created applied to them.  Photoshop CS6 opens the files from Bridge and applies the actions, but then I get the "Script alert" error message "Sorry I could not process the following files" and a list of all of the files in the batch I was trying to run the script on.  The files all remain open and are saved on my hard drive in a folder created by the Image Processor script, but do not close unless I manually close them.  I never had this problem in CS5 where the image processor would apply the desired actions to the batch of photos one at a time, then save and close.  Thoughts on how I can fix this bug?

Viewing all 12244 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>