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

Problems with selection.fill/pathItem.fillPath -- Ps CS6, JSX, Windows

$
0
0

Hi all,

 

First post here

 

I've started lately to play around with extended javascript (jsx) scripting on Photoshop CS6 (using 32-bit version on Windows 7 Ultimate).

 

I've had much trouble with 'fill' commands.

 

This one here gives me an

 

Error 1200: Internal error

Line: 5

->  app.activeDocument.selection.fill( myColor );

var myColor = new SolidColor();

app.documents.add( 100, 100, 72, "tmp", NewDocumentMode.RGB, DocumentFill.TRANSPARENT );
app.activeDocument.selection.selectAll();
app.activeDocument.selection.fill( myColor );

I read somewhere that giving all the parameters to the fill method could solve it, but it gave me the same result.

 

I've also tried the fillPath method from PathItem, but it gave also an internal error (1200).

 

var myColor = new SolidColor();

 

var docRef = app.documents.add(500, 700, 72, "Simple Line")

 

var lineArray = new Array()

lineArray[0] = new PathPointInfo

lineArray[0].kind = PointKind.CORNERPOINT

lineArray[0].anchor = Array(100, 100)

lineArray[0].leftDirection = lineArray[0].anchor

lineArray[0].rightDirection = lineArray[0].anchor

lineArray[1] = new PathPointInfo

lineArray[1].kind = PointKind.CORNERPOINT

lineArray[1].anchor = Array(150, 200)

lineArray[1].leftDirection = lineArray[1].anchor

lineArray[1].rightDirection = lineArray[1].anchor

lineArray[2] = new PathPointInfo

lineArray[2].kind = PointKind.CORNERPOINT

lineArray[2].anchor = Array(100, 200)

lineArray[2].leftDirection = lineArray[2].anchor

lineArray[2].rightDirection = lineArray[2].anchor

var lineSubPathArray = new Array()

lineSubPathArray[0] = new SubPathInfo()

lineSubPathArray[0].operation = ShapeOperation.SHAPEXOR

lineSubPathArray[0].closed = true

lineSubPathArray[0].entireSubPath = lineArray

 

var myPathItem = docRef.pathItems.add("A Line", lineSubPathArray)

myPathItem.fillPath(myColor, ColorBlendMode.NORMAL, 100, true, 0.0, true, true)

 

This example only works if there is not parameters at all given to fillPath (it's filling with black).

 

Does anyone know how I could work around this? Is it a known bug?

 

Thanks all!


Is there a Photoshop Script for resizing photos for social media?

$
0
0

is there a Script for Batch Resizing and side by side photos.

 

Basically i will take two photos and want to put them side by side but with particular dimensions. so the script has to first resize both of them and then put them side by side and later save them.

 

Now i want to resize my photos for the particular Social media sites.

 

Instagram

 

Pinterest

 

Tumblr

 

Facebook

 

Twitter

 

We Heart It

 

I am comfortable changing the script to my liking and am eager to learn, thanks

Javascript Code to select by layer names in Photoshop File!! (using the Jam engine or otherwise)

$
0
0

I have a series of *.jsx files that run on the jam engine, to automatically create a series of image results from template files containing smart objects.

 

My question is!!!

 

Is there a way to select a specific layer/smart object, other than calling out the layer name?!! I ask because sometimes layernames are incorrectly renamed or deleted, and I would prefer a more failsafe method than depending on layer names to render files correctly.

 

Is it possible to select layers by color? Size? Position? Meta Data?

 

Or alternatively, is there a way in the code that I can lock the names of layers so it is impossible to change them?

 

A apologize for the vagueness of the question, I cannot find any options in the Photoshop API reference PDF

 

 

 

With much appreciation,

Thomas Murphy

how can i clean all guides in photoshop?

$
0
0

Hi

 

i have photoshop cs6 on my desktop windows7

and cs3 on my laptop xp

 

is there a script to delete all the guides ?

 

thanks

are we get the area of Layer item in layers pannel

$
0
0

we had been using "documentArea" object to get  area of left/top/right/bottom in screen.See figure 1QQ截图20190321182826.png

and now,could we  alse get the area  of a Layer item in layers pannel?  .see figure 2,Maybe There is no such interface,but

Would anybody here be able to help me out? Thanks!

QQ截图20190321175449.png

Save As PNG script

$
0
0

Hello,

I'd like some help with this script if possible

I wanted to save my open file to PNG format in the same location with the same name. I managed to do that with the scripts below.

 

This is a script I found on the forum:

#target photoshop
main();
function main(){
if(!documents.length) return;
try{    var Path = decodeURI(activeDocument.path.parent);    }catch(e){return;}
if(!Folder(Path).exists){    alert(Path + " Does not exist!");    return;    }
var Name = decodeURI(app.activeDocument.name).replace(/\.[^\.]+$/, '');
var saveFile = File(Path + "/" + Name + "_bump.png");
sfwPNG24(saveFile);
//Uncomment the line below if you want to close the document.
//app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
function sfwPNG24(saveFile){
var pngOpts = new ExportOptionsSaveForWeb;
pngOpts.format = SaveDocumentType.PNG
pngOpts.PNG8 = false;
pngOpts.transparency = true;
pngOpts.interlaced = false;
pngOpts.quality = 100;
activeDocument.exportDocument(new File(saveFile),ExportType.SAVEFORWEB,pngOpts);
} 

 

And this is how I modified it (so that it saves the file in the same folder and doesn't add any suffix to the name; also changed to save as PNG instead of using save for web):

#target photoshop
main();
function main(){
if(!documents.length) return;
try{    var Path = decodeURI(activeDocument.path);    }catch(e){return;}
if(!Folder(Path).exists){    alert(Path + " Does not exist!");    return;    }
var Name = decodeURI(app.activeDocument.name).replace(/\.[^\.]+$/, '');
var saveFile = File(Path + "/" + Name + ".png");
sfwPNG24(saveFile);
//Uncomment the line below if you want to close the document.
//app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
function sfwPNG24(saveFile){
var pngOpts = new PNGSaveOptions;
pngOpts.compression = 9;
pngOpts.interlaced = false;
activeDocument.saveAs(saveFile, pngOpts, true, Extension.LOWERCASE); 
}

 

[b]My problem:[/b]

I don't know what's happening when I try to save a file just created (never saved yet). I thought I would get the Alert message but it doesn't seem to be the case (maybe the alert message in the code is related to a different condition?)

I would like to have a default folder/path in the code so that, if the file hasn't been saved yet, it would be saved in the specified location.

 

If anyone could do it I would really appreciate it!

Thanks

How to convert values from dialog box to text layers

$
0
0

I need help to create a dialog box with java script code, which will have one drop down list (employees names) , one check button (yes/no), one text box (comment) and one button (ok). After selection of proper conditions (employee, yes/no, comment) i need to create text layers with information from dialog box using OK button.

 

Thanks in advance.

ZXPSignCmd not compatible with Windows

$
0
0

Hi Everyone!

 

Looked over the forum and didn't see this issue posted. Sorry if there is a similar issue with an answer!

 

I'm running into an issue when I try to run the ZXPSignCmd.exe. My current Windows setup is Win 10 64bit and I downloaded the 64bit version of ZXP(4.0.7). I currently have it located in a folder where I keep commands related to specific tools. When I call the command following error prompt & log appear & the command fails to run. Anyone run into this before? Let me know if there are any questions and I'll reply ASAP.

 

Thanks!!!

 


Scripting a JPEG 'Save As'

$
0
0

I'm doing some work for my company and I need to do what  is essentially stop-motion animation... I have my base .psd file, I move a layer  in it slightly, save it as a .jpeg, and repeat. And repeat, and repeat,  and repeat.

 

However, it takes way too much time to go through the  'save as' dialogue, change the file name, and change the file type back  to jpeg every time.

 

I don't know anything at all about  scripts (writing them OR using them), but from what I've read that's  where the solution to my problem lies... a script that will save a jpeg copy of my .psd file with a new name.

 

In addition to that, it would be AWESOME if that could be set to a key or key combination... like I hit command + ~ and it runs the script.

 

Can you guys help me?

Batch replace smart objects

$
0
0

Hello,

 

I have very minimal scripting knowledge, and every script I've found for this workflow is partial or results in "undefined".  I am on a mac running Photoshop CC (latest update).

 

This is what I have:

 

  • a mockup file of a book with the cover image set as a transformed smart object
  • a folder of images resized to fit said smart object

 

This is what I would like a script to do (if possible):

 

  • for every image in said folder
  • replace smart object with images
  • save each new mockup (one for each new image) as a PSD file.

 

We have to create over 40 book, CD, DVD, and Blu-Ray mockups for each flyer we do.  Smart Objects help streamline it a little but I'm just going through and using an action right now, which I know is less than ideal.  I don't mind if the file names aren't what I need them to be, so incremental file naming would be fine because I could rename them all later.

 

Any suggestions on how I could streamline this process without having to manually replace and save?

Need reference code to use Scripting API for java to resize images

$
0
0

Hello,

 

As per my initially discussion with adobe team on phone, We have raised our query with adobe team in below portal and link.

 

Need to resize TIFF with transparency

 

After a week of time, they come back with answer but shared solution was not able to clear our query. Now they have asked us to post our query in this portal. In short we are moving one forum to other forum of adobe to clear our query.

 

Here is our question.

 

We need sample java script or API to resize TIFF (Multi layer - Transparency )  images using java code. We have checked below links but we can't find the way how to use this java script to resize images using java code. https://www.adobe.com/devnet/photoshop/scripting.html

 

Hoping for a quick response.

 

Thanks

Rikin

How to run Photoshop jsx on all files in folder

$
0
0

Hello everyone.

I have script that looks like this (btw, using Photoshop CS5)

#target photoshop

    // ========== set units to pixels ==========//

    app.preferences.rulerUnits = Units.PIXELS;

   

    //========== set background to white ==========//

    var backgroundC = new SolidColor();

    backgroundC.rgb.red = 255;

    backgroundC.rgb.green = 255;

    backgroundC.rgb.blue = 255;

    backgroundColor = backgroundC;

   

    //========== set var to active document ==========//

   

    var doc = activeDocument;

   

    //========== main() ==========//

    function main(){ 

    if(!documents.length) return; 

    var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');

    var CurrentPath = activeDocument.path;

    var saveFolder = Folder(CurrentPath + '/' + 'Shop');

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

    var saveFile = File(saveFolder + "/" + Name + ".jpg"); 

   

    if(saveFile.exists){ 

       if(!confirm("Overwrite existing document?")) return; 

        saveFile.remove(); 

        } 

    SaveForWeb(saveFile,70); //change to 60 for 60% 

    } 

    

    function SaveForWeb(saveFile,jpegQuality) { 

    var sfwOptions = new ExportOptionsSaveForWeb();  

       sfwOptions.format = SaveDocumentType.JPEG;  

       sfwOptions.includeProfile = false;  

       sfwOptions.interlaced = 0;  

       sfwOptions.optimized = true;  

       sfwOptions.quality = jpegQuality; //0-100  

    activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions); 

    } 

//========== Set model to RGB ==========//

doc.changeMode ( ChangeMode.RGB );

//========== set canvas depending on initial width and height ==========//

doc.resizeCanvas(Math.max(doc.width,doc.height),Math.max(doc.width,doc.height))

 

 

//========== check size and do actions acording to size of document ==========//

if (doc.width > 750){

        doc.resizeImage(750,750);

        main();

        doc.close(SaveOptions.DONOTSAVECHANGES);

    } else {

        doc.resizeCanvas(750,750);

        main ();

        doc.close(SaveOptions.DONOTSAVECHANGES);

}

Now, I am using it as scripts event manager, on document open trigger, and then I drag and drop images, and script do its job. However, if I drag and drop 200 images, PS will load ALL of them, hog my PC, and probably crash.

 

My question is, how can I set this JSX to run on folder, similar to batch dialog, or image processor, but on those two I can only select Action, no option to select existing jsx script. (guys from Photoshop suggested to record script as Action, but was looking for something more "elegant" so to speak)

 

Thanks in advance

Image Processor Pro not available in Bridge CC 2018

$
0
0

After updating to Photoshop CC 2018 and Bridge CC 2018 the Image Processor Pro (IPP) does not display under the Bridge > Tools > Photoshop menu.

The IPP dependencies were copied from the Photoshop 2017 to Photoshop 2018. The IPP can be accessed from Photoshop CC 2018 > File > Automate > Image processor Pro.. but not from Bridge CC 2018.

 

Currently, Photoshop CC 2017 and Bridge CC 2917 are installed locally and the IPP does display under the Bridge > Tools > Photoshop > Image Processor Pro...

Which IPP version have Mac users been able to successfully install in Bridge CC 2018 in OSX High Sierra?

 

Environment:

OSX High Sierra

MacBook Pro 2015

Error handling - Background or single layer

$
0
0

As a newb to scripting, I am struggling with conditional error handling.

 

The script that I would like to error check is only intended to be run on a document that has multiple layers (not background layer + layers if that makes sense). It should only run if the document index is the second doc open ( app.documents[1] ).

 

The script closes the temporary working file down without saving after it is duplicated to the target document ( app.documents[0] ), so I don’t wish to accidentally run the script on a file that does not meet the following conditions as work may be lost.

 

I’d like to cancel the script with an alert if any of the following criteria are met:

 

  • Doc only has Background layer
  • Doc has Background layer + 1 or more layers
  • Doc has only 1 layer
  • Only one document open or current document is not the second document opened ( app.documents[1] )

Aligning two layers by moving only one

$
0
0

I'm attempting to vertically align two layers (1 text-based, 1 graphic) by only moving the text. I have tried locking the position of one layer, but then the align command isn't available. I then tried this with the following script, which does work up until the text-based layer is a certain length, at which point I get the following error. It seems that the length limit that causes the error is whenever the text is longer than the document, but why would this affect its vertical (y-position) aligning?

Any way to get around this, and position the text at a given y-coordinate, or aligned with another layer, regardless of text length? Thanks!

 

Screen Shot 2019-03-09 at 3.14.48 PM.jpg

 

app.preferences.rulerUnits = Units.PIXELS; 

var doc = activeDocument;

var yPos = 1500;

doc.activeLayer.translate(undefined, yPos- doc.activeLayer.bounds[1].value);


How to rename specific Layer set (Group) with javascript

$
0
0

I have a script which create a set of layer and collects those layers into group. I want to rename that group with specific text using additional javascript line.

Please help. Thanks in advance.

Try to copy when no pixels where selected

$
0
0

Hello everyone,

 

I have a document with an empty layer and I made a selection. When I click Ctrl+C to copy i get this "Could not complete the Copy command because the selected area is empty." any idea on how to throw a try catch or if in a script? (if I can't copy I want an alert "can't copy")

 

How to disable auto rename text layer with content

$
0
0

HI Every one,

 

I want to disable the auto renaming feature in text layers so that I can change the content without change the name of the text layer.

 

also i want to do this to all the text in one step, wthout do it manual one by one.

 

for more description, i am working on replace English text with other language but i want to keep English name of all text layers SO i want to disable auto renaming while replacing the content.

 

I guess a Script could do this by changing the names (adding a space or a _ for example)

 

 

Thanks in advance

 


  

Find and replace text in multiple Photoshop files?

$
0
0

Hi there,

 

Let us say I have six Photoshop files: 1.psd, 2.psd, ..., 6.psd. All of these files contain the word “LoremIpsum” in random text layers, within each document. Is there a way I can search for “LoremIpsum” in all documents and replace it with “Dolor Sit Amet”, all in one go? This is just an example, I need to replace various words, not just one.

 

I have tried "batch find and replace" software (including powerful tools like Power Grep) but they do not work with psd files… Is there a javascript of external plugin for this kind of task?

 

 

Thanks!

Photoshop CS and script folder location

$
0
0

Hello Community,

I had a look around but can't find my solution.

 

I recently upgraded my Apple OS from 10.6 to 10.9. I was using Photoshop CS for my small needs as my main RAW covnerter is Capture One and have upgraded to CS4.

I forgot to export the actions (scripts) that I had done.

 

I can't seem to locate them in the CS folder on the app folder and in the library.

Anyone has a solution ?

 

Thanks in advance for oyur help and Best Wishes for the New Year.

 

Denis

Viewing all 12244 articles
Browse latest View live


Latest Images

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