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

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 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?

How to create a solid fill layer (shape layer)

$
0
0

Hi again

 

Still rookie question I guess :S

 

I just try to create a solid fill layer.

The ScriptListener Code doesn't work :S

 

I can check if a layer is a solid fill 

if (doc.activeLayer.kind == LayerKind.SOLIDFILL)

I found a way to change the color of an existing one...

(borrowed CodeListener code)

f

function setColorOfFillLayer( sColor ) {    var desc = new ActionDescriptor();        var ref = new ActionReference();        ref.putEnumerated( stringIDToTypeID('contentLayer'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );    desc.putReference( charIDToTypeID('null'), ref );        var fillDesc = new ActionDescriptor();            var colorDesc = new ActionDescriptor();            colorDesc.putDouble( charIDToTypeID('Rd  '), sColor.rgb.red );            colorDesc.putDouble( charIDToTypeID('Grn '), sColor.rgb.green );            colorDesc.putDouble( charIDToTypeID('Bl  '), sColor.rgb.blue );        fillDesc.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), colorDesc );    desc.putObject( charIDToTypeID('T   '), stringIDToTypeID('solidColorLayer'), fillDesc );    executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
}

 

But I'm unable to simply create a "solid fill layer"...

 

Thanks for help !

Have a nice day.

 

Vinz

How to remove xmp metadata?

$
0
0

I need to remove the "XMP metadata" information in the tiff(photoshop) files via scripting. Is it possible? Kindly advice me. Please provide examples.

 

Thanks for looking into this..

 

Regards,

Maria Prabudass

Curious about Dialog Box Alignment! when opening

$
0
0

Hello guys!

1- Is there any command I can open, a native Photoshop dialog box from a custom dialog box with the same "x, y" coordinates?

2- How do I abort this error on line 14 when I click the cancel button?

Thank you

 

win=new Window("dialog","Window test!",[0,0,355,125]);
panel=win.add("panel",[10,10,340,110],"Open a dialog box in the same location x, y of this window!");
btn_open=panel.add("button",[33,34,283,54],"Open a window .. Ex: Levels");

////////////////
btn_open.onClick = function() {
if(app.documents.length == 0){
    alert("There needs to be an open document!");    }

else {
    docRef = app.activeDocument;    var descriptor = new ActionDescriptor();
executeAction( stringIDToTypeID( "levels" ), descriptor, DialogModes.ALL);   }
}

win.center();
win.show();

Would like to automate open stacks as layers + run action. Possible with script??

$
0
0

I would like to automate part of my workflow that involves opening stacked images as layers in Ps CS5 and running an PS action that composites the layers and processes the image. Something similar to 'Process Collection' in Bridge CS5 only with my own action instead of merge to HDR/Panorama.

 

Apparently this is possible with Mac 'Automator' - is there anything I can do in Windows? I don't have any experience with writing scripts, but have friends that can help. Can someone tell me if its possible and point me in the right direction please?

Input "TextField" in JavaScript

$
0
0

Hello, I would like to ask in view of JavaScript, and Adobe Photoshop namely the creation of any input TextField. I want to be an interactive script. I mean the script that creates a simple card, where previously we enter the name into the input TextField. Scripts created in the program ExtendScript Toolkit I would be glad if you write a simple script using said input TextField. Thank you

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


A script to run an action according to the file name

$
0
0

Dear All,

 

I hope someone can help.

 

I am looking at the following task: I have several .jpg files in a folder. Their names are something like "ADE-4LP.jpg" or "DBA-3P.jpg" or "EFC-1P.jpg"

 

I would like to open these files in Photoshop and then run actions according to their file names. So for example, if the file name has the -4LP ending, the action named "Create4LP" is triggered. If the name has the -3P ending, the action "Create3P" is triggered and so on.

 

Can this be done with a script ?

 

Thanks muchly !!

 

Felix

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?

Smart Object Automation Script

$
0
0

Hi,

 

I'm currently trying to make a couple of tweaks to this script, (the script currently grabs a number of files from a folder and replaces the content of a smart object and saves individual jpgs):

 

#target photoshop

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

var theName= myDocument.name.match(/(.*)\.[^\.]+$/)[1];

var thePath = myDocument.path;

var theLayer = myDocument.activeLayer;

// jpg options;

var jpgopts = new JPEGSaveOptions();

jpgopts.embedProfile = true;

jpgopts.formatOptions = FormatOptions.STANDARDBASELINE;

jpgopts.matte = MatteType.NONE;

jpgopts.quality = 8;

// check if layer is smart object;

if (theLayer.kind != "LayerKind.SMARTOBJECT") {alert ("selected layer is not a smart object")}

else {

// select files;

if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog ("please select files", "*.psd;*.tif;*.jpg", true)}

else {var theFiles = File.openDialog ("please select files", getFiles, true)};

if (theFiles) {

// work through the array;

          for (var m = 0; m < theFiles.length; m++) {

// replace smart object;

                    theLayer = replaceContents (theFiles[m], theLayer);

                    var theNewName = theFiles[m].name.match(/(.*)\.[^\.]+$/)[1];

//save jpg;

                    myDocument.saveAs((new File(thePath+"/"+theName+"_"+theNewName+".jpg")),jpgopts,true);

                    }

          }

}

};

////// get psds, tifs and jpgs from files //////

function getFiles (theFile) {

     if (theFile.name.match(/\.(psd|tif|png)$/i) != null || theFile.constructor.name == "Folder") {

          return true

          };

     };

////// replace contents //////

function replaceContents (newFile, theSO) {

app.activeDocument.activeLayer = theSO;

// =======================================================

var idplacedLayerReplaceContents = stringIDToTypeID( "placedLayerReplaceContents" );

    var desc3 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

    desc3.putPath( idnull, new File( newFile ) );

    var idPgNm = charIDToTypeID( "PgNm" );

    desc3.putInteger( idPgNm, 1 );

executeAction( idplacedLayerReplaceContents, desc3, DialogModes.NO );

return app.activeDocument.activeLayer

};

 

I need to change the script to select a folder of images, rather than specific files using this:

 

var theFolder = Folder.selectDialog ("select folder");

if (theFolder) {

var theFiles = theFolder.getFiles(/\.(jpg|tif|eps|psd)$/i)

};

 

However my lack of JS experience is showing and i can't figure out where to insert the new lines of code.

 

It would also be ideal if I could incorporate a way to open up a dialogue which would allow me to select a destination folder for the saved files.

 

Hope this makes sense!

 

Thanks in advance,

 

Rik

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!

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

How to create a solid fill layer (shape layer)

$
0
0

Hi again

 

Still rookie question I guess :S

 

I just try to create a solid fill layer.

The ScriptListener Code doesn't work :S

 

I can check if a layer is a solid fill 

if (doc.activeLayer.kind == LayerKind.SOLIDFILL)

I found a way to change the color of an existing one...

(borrowed CodeListener code)

f

function setColorOfFillLayer( sColor ) {    var desc = new ActionDescriptor();        var ref = new ActionReference();        ref.putEnumerated( stringIDToTypeID('contentLayer'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );    desc.putReference( charIDToTypeID('null'), ref );        var fillDesc = new ActionDescriptor();            var colorDesc = new ActionDescriptor();            colorDesc.putDouble( charIDToTypeID('Rd  '), sColor.rgb.red );            colorDesc.putDouble( charIDToTypeID('Grn '), sColor.rgb.green );            colorDesc.putDouble( charIDToTypeID('Bl  '), sColor.rgb.blue );        fillDesc.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), colorDesc );    desc.putObject( charIDToTypeID('T   '), stringIDToTypeID('solidColorLayer'), fillDesc );    executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
}

 

But I'm unable to simply create a "solid fill layer"...

 

Thanks for help !

Have a nice day.

 

Vinz

Is there any way to identify animated layers using JSX script?

$
0
0

I am creating timeline animation.

I need to extract only animated layers using script,
Is it possible?


Show custom shape panel!

$
0
0

Hello Friend!

Is it possible to write a script that shows the panel so that it stays in the "Custom Shape Tool (U)" property bar? Unfortunately I could not do this with the ScriptingListener.

Screenshot_1.jpg

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?

Photoshop Action specifics

$
0
0

Hello all - I'm a newbie to writing PS actions and need some basic help - searching the www has not yielded me the answers I'm looking for...

 

I'm trying to create a template for a collage image made up of multiple layers/masks, and want to use an action to populate it.

 

For example, my base document has 6 layers, each with a mask for a square in the grid. The layers/masks are named 1.1, 1.2, 1.3, 2.1, 2.2, and 2.3 (so two rows of three masks). The goal is to have the action prompt the user to place an image on top of a chosen layer and then clip the layer to the underlying mask. Layer 1.1, for example, has a mask of just that square. In my action, I want to place an image in the document, program a Stop, and have the user move/scale the placed image over square 1.1. Then I want the action to clip the placed image to that layer/mask. I then want to repeat that for each square on the grid.

 

I'm having trouble with a couple of things: 1) how to record the Place command without recording the file selected; 2) how to set the selection to the next layer (1.2) and then carry out the same set of instructions. Sorry of this isn't clear - trying to explain it while performing the steps.

Here is a quick view:

grids.jpg

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

Is it possible to script brush opacity?

$
0
0

I would like to script the current brush's opacity to 20%. Have done a lot of googling but cant find a clear answer. Is this possible?

 

On a Mac with Photoshop CS6

Viewing all 12244 articles
Browse latest View live


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