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

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


Photoshop Actions and Batch Processing Snafu

$
0
0

Good Day,

I need to batch process thousands of files, the end result being their dimensions should be no larger than 200x200px. My problem lies that I need to rotate the portrait-oriented files to a landscape orientation. We deal with many rectangular files (originally as big as 5 foot by 10 foot) and I would like the end result to have everything horizontal (i.e. the vertical ones resting on their side).

 

I set up an action to pause and ask me if I wanted to rotate (it was a vertical file), then every file after asked the same question in which I clicked cancel because I did not want the horizontal files to rotate, and thus the action did not save the rest of them.

 

Is there any action or script I could use that has an "If/Then" sort of scenario? For example, *if* the dimensions are taller than wide, *then* rotate, otherwise leave the file alone?

 

Thanks!

Conditional Image Resizing

$
0
0

Hi

 

Ive been using batch processing in photoshop since version 7, however Ive recently found the need to do conditional actions - which apparently can be done with photoshop scripting.

 

What Im trying to do is resize an image if it is over a certain size (document dimensions that is) but leave it at its original size if not.

 

If I was coding in C or something Id probably do (forgive the poor pseudo code)

 

if(document.height*document.width>640000){document.resize("50%");}

 

Can anybody point me in the right direction for creating this type of script in photoshop CS4?

 

Many thanks

 

James

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?

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.

Photoshop open multiple image and add different texts

$
0
0

Hi All,

 

Hope you are all doing great. I just started doing photoshop scripting due to the requirement which I will mention in detail below.

 

My scripting is knowledge is very basic so I was hoping you guys could be able to help me out with this.

 

The requirment is that I have 100's of images which needs to be opened in photoshop and add text based on the image name then save the image as JPEG at 70 quality. For example:

 

I have images named as below in my desktop folder,

 

Image1.jpg

Image2.jpg

Image3.jpg

Image4.jpg

Image5.jpg

Image6.jpg

Image7.jpg

Image8.jpg

Image9.jpg

Image10.jpg

 

For the script, I think the easiest way is that if I define what image name are:

 

image[1] = Image1.jpg

image[2] = Image2.jpg

image[3] = Image3.jpg

image[4] = Image4.jpg

image[5] = Image5.jpg

image[6] = Image6.jpg

image[7] = Image7.jpg

image[8] = Image8.jpg

image[9] = Image9.jpg

image[10] = Image10.jpg

 

and for text I have done this:

 

text [1] = Image1

text [2] = Image2

text [3] = Image3

text [4] = Image4

text [5] = Image5

text [6] = Image6

text [7] = Image7

text [8] = Image8

text [9] = Image9

text [10] = Image10

 

So everytime when I run the script image1 will be added to the photoshop and the text name Image1 will be added (For this I think defining layer name would be better so I will gave "Imagetext").

 

Then the image will be saved on a specific location on my desktop.

 

I have all this plan on what I want to do but I don't know how to write the script using photoshop API and my limited javascript coding.

 

So if you guys could help me out with this, that would be awesome. Hope to hear on this soon.

 

Kind Regards,

 

Zoogle

Intermediate responses ?

$
0
0

Hi everyone!

I have a javascript project which is working fine, but now I need to use BridgeTalk to send intermediate responses (Just 1 bt.send(); and X bt.sendResult() back).

I have read the documentation and copied the example that is on it, but it doesn't work. bt.sendResult() returns false which means that there isn't any onResult callback function or simply the message couldn't be sent.

 

Does anybody know what the problem is?

 

Thanks in advance.

 

PD: Documentation's sendResult example is on JAVASCRIPT TOOLS GUIDE CS6 page 176

Help with large .psb 64-layer file

$
0
0

Hi All, I'm hoping someone here can help me with this!

 

I have a large 64-layer .psb, with each layer visible, the result looking like a 64-box matrix (or chessboard). Each layer has a high resolution image in it which comes from it's own separate .psd  What I want to do is replace each layer's content with a new file (I have 64 source files ready to go).

 

I have two questions:

 

  1. Will I need to step in to each layer of the .psb, delete the existing content, open the new .psd, and copy & paste it into the now empty .psb layer, and repeat x 63 times? Or is there a way that I can automate this?
  2. Can the .psb layers contain linked RAW files such that if I want to adjust one of the .psb layers, I need only open the RAW file in ACR and make my adjustments there?

 

I would be really grateful for your help on this, as I am a total newbie to scripting etc.

 

Many thanks in advance!


CS6 png save options

$
0
0

I've got a major script I use that performs .png saving every few seconds, but apparently there are some new compression options in CS6.  Is there a way for me to have the script use the "Smallest / Slow" compression option if CS6 is in use?  I currently use the script below for saving:

 

 function SavePNG(){    permSaveFile = new File(permSaveFile);    pngSaveOptions = new PNGSaveOptions();    activeDocument.saveAs(permSaveFile, pngSaveOptions, true, Extension.LOWERCASE);}

 

How would I add the extra CS6 save option in while still being able to use the script with older versions as well?  The rest of the script works fine and it saves fine under CS6; the only reason I need to change this is, the output files are HUGE using it, as is, under CS6.  Thanks for any help!

 

dgolberg

Cannot open a file by Applescript

$
0
0

With Photoshop CS6, I am getting an error trying to open a file. This breaks a few of my scripts which continue to work with CS5.

 

This code, copied almost exactly from the CS6 Applescript Reference, returns

 

error "Adobe Photoshop CS6 got an error: File some object wasn’t found." number -43

 

Passing myFilePath to Finder works perfectly fine to open the alias.

 

tell application "Adobe Photoshop CS6"

          set myFilePath to alias "Macintosh HD:Users:ats:Downloads:Photoshop-CS6-AppleScript-Ref.pdf"

          tell application "Finder"

  openmyFilePath

          end tell

  openmyFilePathasPDFwith options {class:PDF open options, height:pixels 100, width:pixels 200, mode:RGB, resolution:72, use antialias:true, page:1, constrain proportions:false}

end tell

Will KillWhite run on Photoshop CS6 64-bit?

$
0
0

So - now that I am in need of what looks like just the most perfect and amazing solution... am stymied about getting it to work with CS6 Photoshop Extended (64-bit) - what am I missing?


When I run the filter (in CS6 64-bit), white isn't removed, instead the entire image gets all smeary as if the Oil Paint... filter had been applied.

 

Attempts in getting KillWhite to run from other CS installations on this 64-bit machine; CS4 & CS5.5 both 32 and 64, have been even more frustrating requiring re-entry of serial numbers, EUAs, etc., only to have PS fail to run at all even with several computer restarts and much testing.

 

Thanks for any help.

 

Kelly

 


Help on Generator event

$
0
0

Hi everyone. Has anyone played with Generator scripts? I have no idea where to look for help: except for several tutorials on Tom Krcha's website I can't find any documentation.

 

What I'm trying to do is launch JSX code every time the document updates. The problem is that this JS counts as an event and I'm getting an infinite loop. For now I put a timer check but I guess that is an ugly solution, because I don't know what time would take operations on different machines. Does anyone know if there's a different event I can use?

 

Here's my main.jsx:

 

(function () {

  

   "use strict";

  

   var generator;

   var i = 0;

   var lastOnChangeRunDate = getTime();

 

 

   function getTime() { return (new Date()).getTime(); }

  

   function init(gen) {

      generator = gen;

      generator.addMenuItem("fp", "test pludsfdfdsin", true, false)

      generator.onPhotoshopEvent("imageChanged", trololo);

      }

 

 

      function trololo ( e) {

        if(getTime()-lastOnChangeRunDate<400) return;

        lastOnChangeRunDate = getTime();

        i++;

        var str = "doc = activeDocument; \

              tL= doc.layers[0]; \

                 tL.textItem.contents = "+i

        generator.evaluateJSXString(str);

        }

     

  

   exports.init = init;

  

}());

automate save with adding a number

$
0
0

Hy all,

 

this is the situation:

 

I have got a psd file. I want this file to be saved automatically as Documentname1.png while it originally is Documentname.psd.

 

The script doesn't have to ask what number i want to add, i can find that in the script and change that myself.

 

It also have to save the file in another folder than where the Documentname.psd is saved.

 

Could anyone creat a script for this action? I don't have any experience at scripting at all.

 

Tnx!

How to batch process .png's

$
0
0

I tried Image Processing but it wont save .png's. Anyone know how to do this?

Resize Layer with action but not in %

$
0
0

Hi,

if i register an action to resize a layer in inches or in pixel, the action will be registered only in %.

So if i would like to resize many layer with different dimensions, i can't have all in the same dimensions.

How i can do it?

Is there a script?

Regards,

Vincenzo


Save in file location?

$
0
0

Hey all. I'm really confident with actions, but new to scripting. I'm looking write something to 'save as' a file into the open file's location. So whatever file I'm working on, when I run the action or script it will save to the current folder. I haven't found a way to do this with actions so I want to know if I can with scripts.

 

For example, on the desktop I have a test1 folder and test2 folder. I can record an action to save an open image from test1 to test1, but then open images from test2 go back into test1. My work around right now is another action (file/automate/batch) to run the saving action and open the dialog box where I can direct it where to save.

 

I appreciate any help.

-Matt

Export only a single layer as image without hiding other layers?

$
0
0

I know I can just make only one layer visible and then save as e.g. PNG. But my question is - do I have to make all other layers invisibile in order to save only my one single layer as image? Or is there a way to save only a single layer (or a few at once) without hiding the rest of them?

Getting old font size value of text after image resizing.

$
0
0

Hi all,

 

I write the script of getting font size of the text layer. I am getting old font size after image resizing.

 

Following are the steps:

- I write the function to get the property of selected text layer..

 

     getInfoOfText=function(textLayer)

     {

          ........;

          var textItem = textLayer.textItem;

          var fontSize = textItem.size;

          .........;

     }

 

- After image resize to 50%. I am executing this function.

 

But, I am still getting old font size value.

Let's say the font size of text = 36 px.

Now I apply Image Resize to 50%. So, the font size of the text becomes 18 px.

Now If I execute the function "getInfoOfText", I am still getting 36 px.

 

I am unable to understand the behaviour. Am I missing something here? Is there any way to get the correct font size value?

Please note that I am using CS6 version.

 

Waiting for ur help guys.

 

Thanks

How to check the layer's color?

$
0
0

color.png

I want to check the layer's color in the photoshop script (javascript). I'm writing a file exporter and I want to do one thing or another depending on the layer's color.

How to save layers with cropping?

$
0
0

I want to export layers to files (basically what "Export Layers To Files.jsx" does) but with cropping each layer (to different sizes). I know how to crop a document from script, but that also crops all other layers (erases their content outside of the cropping area). So my question is - how do I keep/retrieve the cropped out content of the document (layers)? Or maybe there's a better approach altogether?

Viewing all 12244 articles
Browse latest View live


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