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

Select all layers with the same name

$
0
0

I'm setting up a bunch of actions in PS Cs5 but I've hit a wall with the way photoshop selects layers by name.

If I name two layers "example" and have an action that selects "example" it will only select the bottom layer.

Is there a workaround using actions? And if no, is there a way to do this by script?

 

(Word of warning, I have never tried anything with photoshop scripting so assume I know nothing about it.)


Batch processing PDF to TIFF

$
0
0
Hello,

I have about 1000 drawings in PDF format that I need to convert to B/W TIFF files. I thought I could easily do this in Photoshop (CS3) and then I hit a snag. In the Open form for the PDF there is a field to enter for the filename (I think that's because of multisheet PDFs). In my case all the PDFs have been reduced to single sheets, so I want the name to be that of the PDF file. Creating an action captures the "name", but this conflicts with the options when running in batch mode. I either have the same name from the action, or no name (or the same name) from batch options. Anyone know how to get around the naming options? Or do this a different way?

Thanks.

Hide/Show specific layers

$
0
0

Hi,

 

How can I Hide specific layers and then show one layer?

 

Im making a pannel with configurator 4 to help me with some things.

 

what I would like to do is, I have some layers and I want to show only one of them.

 

Example:

I have these groups in my psd file

 

-Overlays

     -Overlay 1

     -Overlay 2

     -Overlay 3

     -Overlay 4

     -Overlay 5

     -Overlay 6

     -Overlay 7

     -Overlay 8

     -Overlay 9

 

And I need to have them all off exept one. But i dont want to effect the other layers in my psd.

Save as png in different size and file name suffix.

$
0
0

Maybe someone can help me on this Photoshop script. I am working on a psd file with few layers in Photoshop CS6. I would like to save it to the png format.

 

Below is my workflow.
1) Drag and drop 01.psd into Photoshop from A folder.
2) Save 01.psd to 01.png into the A folder with different sizes and suffixes as shown below:

    - name: 01-xhires.png, size: 180x180

    - name: 01-hires.png, size: 90x90

    - name: 01.png, size: 45x45
3) With png options: (I have no idea of some options below, but at least you know what I am lookng for. )

    - Compression: Smallest/Slow

    - Interlace: None

    - Transparency: True

    - Blur: 0:0

    - includeProfile = false

    - optimized = true

    - quality = 100

    - PNG8 = false

4) Use lower case extension.
5) Other options should be in default setting.

 

The script should be able to:

1) Overwrite the png files whenever the psd file has been updated and saved multiple times without prompting.
2) Save the png files into the same folder as the source file without creating any subfolder.
3) Not close the psd file, but still keeping it opens in the Photoshop without any changes.

 

Please help, thank you very much.

Trial or Time limited versions

$
0
0

Hi

 

Is there any (simple) way to create a time limited version of a compiled script file? For example 30 days or 10 uses etc?

If there's nothing built in does anyone know of any 3rd party solutions?

 

Thanks for your time.

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.

Mantain the same name with whitespace

$
0
0

I'm trying to make some batch operations on images. All works great, but I noticed that the image name are changed.

 

When I save my image, if the name contains space, photoshop automatically convert this whitespace to "-". I want preserve my image name, because I have those informations stored in the database and after the change name I cannot find the correct path of the image.

 

For example an image called "Google Analytics.png" become "Google-Analytics.png" but I DON'T want that extra "-".

 

This is my script routine:

 

 

function SavePNG(saveFile){    var file = new File(saveFile);    var pngOpts = new ExportOptionsSaveForWeb;     pngOpts.format = SaveDocumentType.PNG    pngOpts.PNG8 = false;     pngOpts.transparency = false;     pngOpts.interlaced = false;     pngOpts.quality = 100;    app.activeDocument.exportDocument(file,ExportType.SAVEFORWEB,pngOpts); 
}

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?

time of opening document

$
0
0

Hi,

 

is there a property to read, at what time a document was opened.

Target is to know how long it took to edit a document.

File will be opened via the File - Open dialog, at that point no scripting involved,

but at the end the file is saved by using a javascript. In that script i wan't to make a log file with edit time

One-click 'Save as jpeg' shortcut script please! - saved in the same folder

$
0
0

Hi, I've been re-directed here because I was told a script could solve my problems - but I have no scripting experience/knowledge/ability! Below is my original problem and post. I got as close as 2 button presses, but I'm after that sweet, sweet single-button, double-my-productivity shortcut! Thanks!

 

http://forums.adobe.com/thread/1106992

 

I use 'Save as .jpeg' ALL the time (Photoshop CS6, Mac ML), and it really feels like I should just be able to press one button (a shortcut) and the name/quality dialogs don't appear and it just saves a .jpeg into the folder that my original .PSD/file is in.

 

So basically:

 

- Press one button to save my open .PSD/file as a .jpeg

- Automatically save it in the same folder as my .PSD

- Save it as '10' quality in the jpeg settings

- No dialog boxes, as soon as I press the button, it saves it - if there's already a .jpeg of the same name, it creates a '-1','-2' etc.

 

I've tried using 'Actions', but it seems to save it wherever my original Action folder was - it doesn't change to whatever the current folder the .PSD is in...

 

Thanks!

 

Adam

Execute() command not working on Photoshop CC

$
0
0

This code works perfectly on CS6 but not on CC. Any ideas on how to solve it?

 

var toGo = File(String("/Users/asouza/Documents/K3/test/test.log"));          

toGo.execute();

 

Thanks,

Alex

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

Associate Brush/Tool Preset with Layer

$
0
0

I know there's a way to do this via scriptinglistener, so I figured I'd post it here. Wondering if there's a way to select a brush or tool preset automatically whenever you select a layer.

 

For example, there are 2 layers:

 

'Airbrush' - I only want to use the tool preset 'MyAirbrush' on this layer and never use any other brush or tool preset

 

'Pastel' - I only want to use the tool preset 'MyPastel' on this layer and never use any other brush or tool preset

 

 

So, when I select the layer 'Airbrush', it will automatically select the tool preset 'MyAirbrush' along with it. And whenever I switch to the layer 'Pastel', it will automatically select the tool preset 'MyPastel'. This would eliminate having to select the tool preset after selecting the layer (no big deal but could save time and eliminate a step)

 

Like I said I can acheive it via scriptinglistener, but then it becomes confusing because instead of simply switching layers in the layer panel, I'd have to run the script instead, and each script would reflect only one individual layer and the tool preset to go with it- I'd have to create a script for every layer doing it this way - not feasible. I was wondering if there was another way to do it somewhere in Photoshop, such as 'link tool preset to layer' or 'associate tool preset with layer'

 

thanks!


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!

Get file from ftp

$
0
0

Hi all,

 

I looked on the forum for answers on that topic but didn't really find anything simple.

 

I would like my Photoshop javascript to retrieve a specific image file from a ftp server before doing its thing inside Photoshop.

I tried putting the ftp address along with login and password the same way I would specify a local path, but this doesn't seem to work (this might be an obvious mistake, my javascript knowledge being somewhat limited). Is there another way?

 

Thanks,

 

John

custom controls : How to force redraw ?

$
0
0

Hi,

 

I'm playing with custom controls, this sample shows how to move squares in an image. The only way to force redraw I found is to hide then to show the control. Is there a nicer solution ?


var myWindow = new Window ("dialog", "Draw squares");

myWindow.add ("button",undefined,"cancel")

var CompoPreview  = myWindow.add ("image", undefined)
CompoPreview.size = [200,200];
CompoPreview.onDraw = generatePreviewPhoto

var myEvent = new UIEvent("resize");

var MySlider = myWindow.add ("slider", undefined, 50, 0, 100);
var coef=MySlider.value

MySlider.onChanging = function ()
{
    coef = this.value;
    CompoPreview.hide()
    CompoPreview.show()
}

function generatePreviewPhoto(){
   
var x,y,l,h,idx,gl;


nbPhotos = 5;
for (idx=0;idx < nbPhotos;idx++)
    {
        y = x = idx*coef    ;
        l= 30;
        h= 30;
        gl  = 1-idx/(nbPhotos-1);
       
        this.graphics.newPath();
        this.graphics.rectPath(x,y,l,h);
        this.fillBrush = this.graphics.newBrush( this.graphics.BrushType.SOLID_COLOR,[gl,gl,gl,1] );
         this.graphics.fillPath(this.fillBrush);
    }

}

myWindow.show ();

How to batch process .png's

$
0
0

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

Viewing all 12244 articles
Browse latest View live


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