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

Unzip a file

$
0
0

Hi Team,

 

Is there any possibility of unzipping a file from desktop and execute an action through PS.


Photoshop CC 2015 changes to scripting

$
0
0

It's again the time of year that Adobe releases a new version with some new "features" so I was thinking we should share issues to minimize time on debugger

 

  • Greatly improved Javascript performance, I'd say at least 2-3x improvement in my scripts, Kudos Adobe
  • Dialogs are much more responsive and change updates immediatelly. However in my end loop (waiting for user to click OK) dialog became unresponsive and hanged Photoshop. Needed to add app.refresh() in the loop (but don't use in script as it has great performance impact).

 

So far looking looking good, but please share if you discover some changes

How to record an action for healing brush/clone tool ?

$
0
0

Hi,

 

most of you who know photoshop so well, know it's a fact it's impossible to record an healing brush or a stamp tool to apply. Also is knowns the patch tool is the only way to make theses kinds of corrections and record them but the patch tool is not doing a great job as the healing brush, if you know your stuff.

 

This situation is never the less something many can experience, shooting products and having the same spots, dust and scratch to remove over 600 images is a major challenge.

 

I know when photoshop cannot record tools or specific task then scripting is the way to go.

Will scripting can open new possibilities to use healing brush corrections over an image to apply over many others doing the same corrections ?

 

Also I'll post this in the request for new versions or updates coming up in photoshop family page.

 

Mark

Get List of all Photoshop Documents

$
0
0

Hi everybody

 

I was wondering - does anyone know of a way to get a list of all documents that are currently loaded into Photoshop? The list would include the entire title of each document, (including the @33.3%, (RGB/8)*that might come after each title, for example.)

 

Basically, it would be a simple list, with each title on its own new line.

 

I could have sworn that I had some code like this before, but can't find it.

 

Is this a simple task?

 

Thanks in advance

Can Someone Explain What This Means.

$
0
0

Looking at the Script-listener log, the first part of an action shows the following

 

function step1(enabled, withDialog) {    if (enabled != undefined && !enabled)    return;

 

Can anyone briefly explain what is happening in these 3 lines please

How to debug properly?

$
0
0

I have just started with photoshop scripting in CC 2015 and it's really bothering me that I cannot properly debug my scripts. For example photoshop returns an array/object and I want to look what's inside this array/object - how am I supposed to do that?! In photoshop itself I just have the alert command that isn't showing contents of arrays/objects. The extrendedScript Toolkit CS6 is the same. When I select photoshop at the target software dropdown the script runs in photoshop, so no debug infos in the toolkit. When I select the toolkit it throws errors because it doesn't know any photoshop functions.
Am I missing something or doing something wrong?

Scripting Circles with JS (Photoshop CC 2017.0.1)

$
0
0

Hi,

 

I'm not finding any good examples to help me write a function to draw Circles in Photoshop CC with JavaScript.

 

I want to provide:

 

- Radius (or Diameter), in pixels

- Center Point (x,y), in pixels

- Stroke Width, in pixels

- Fill Color (I'm not sure what's the best here, words, or Hex?)

 

Something like:

 

Circle( 100, 200, 300, 5, 'White')

 

Most examples I'm seeing are for older versions and no longer work, or are overly complex.

 

Any simple solutions floating around?

 

Thank you!

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


Searching Arrays - indexOf

$
0
0

I was trying to search an array, and on the web it says to use something like this:

 

var tA = ['one','two'];

$.writeln(tA.indexOf ('one'))

 

However, when I try this, I get: tA.indexOf is not a function."  It works with a string variable but not an array.  Is this a bug, or an I doing something wrong?

Closing a document within Javascript.

$
0
0

I'm new here and new to javascripting in photoshop (though not new to javascript).

I've been trying to figure out how to do the equivalent of either the "File>Close" or the "File>Close All" menu item. Preferably programmatically specifying changes not be saved as the script will have saved what it wanted saved before closing.

I can't find a sample of this nor could I find other references to it in the forum. I'd appreciate any help that can be provided for this.

Thanks,

Steve Ellis.

Selecting custom pixels

$
0
0

I have binary mask image. What the most convenient way to make selection with form of this mask?

Export as... script

$
0
0

Hi,

 

I am currently working on a script that lets the user export an image in various resolutions (first photoshop script I'm working on...).

there is the method Document.exportDocument, but I can only use ILLUSTRATORPATHS or SAVEFORWEB as export type, which is equivalent to File > Export > Paths To Illustrator or File > Save for Web and Devices (see documentation), the latter being replaced by File > Export As... in more recent versions of photoshop CC.

So far I wasn't able to locate the javascript scripting reference for CC 2016 and later, hence my question: does anyone know either where to find the javascript reference or what the corresponding function is to do a File > Export As... in the script?

I'd prefer not to use the legacy save for web since the quality of the new export as is way better at the same filesize.

 

best,

peter

[Q] Is accessible (get/set) for Brush Settings' Lock features?

$
0
0

Hi all,

 

I'm trying to access (get/set) for Brush Settings' Lock features as following yellow rectangle part.

Are these accessible (get/set) from script?

 

The reason I'd like to access is protecting value changes on Opacity, Flow, Smoothing, Strength, Exposure on brush value by script.

Current code is get and reset following green part. But red part gets reset and I'll need work on.

It seems when yellow part are "protected", it seems no get reset by above (opacity, flow, ...) changes.

#original purpose was just changing opacity, etc, but got reset issue and trying to avoid.

 

 

20171110_brush_status01.png

 

There seems not recorded by ScriptListner and regular Actions.

I also searched around exported getter.xml from Xtools' GetterDemo.jsx file.

xtools

But I could not find related properties.

 

capture_20171113_091720.png

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

Batch image resize/crop

$
0
0

Hi

 

I have a lot of images that need resizing to a specific size (1920x805) and saving out for web (ideally around 200kb max file size) to be used as hero images on a website.

 

Up until now, I have been doing this manually using the following process:

 

Create new 1920x805 pixel canvas

Drag image(s) into canvas, scale proportionately and centrally (holding shift + alt) until they fill the canvas

Save for web in jpg format, with a quality value of 30

 

I am completely new to Photoshop Scripts and Actions. Does anyone know if it is possible to automate this process using either a script or an action or maybe a tool/plugin?

 

Any help would be greatly appreciated.

 

Thanks


Automatically run scripts on files in a specific folder

$
0
0

Hello all!

 

I have a series of very effective scripts that I am running against a series of photoshop files. Now the big quiestion!

 

Is there a program to

1) "watch" a folder, so when a file is saved in that folder.

 

2) It runs my script(s) on that file?

 

If you look at it simply-- I would like to replace the "drag and drop" method used for droplets, with the "drop in the folder" method.

No doubt this would require a separate program, to consistently check the folder for new files.

 

This is something that I would prefer to tackle with python, but maybe you all in the community could provide me with a more "industry accepted" solution?

 

Oh and Ideally I would run this on both mac and PC.... though I understand if windows makes more  sense for an operation like this.

 

Best,

Thomas Murphy

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

Action that remove background and image batch process

$
0
0

Hi, I have a bunch of images just like attached below in terms of size and feel, I just want to make an action to remove background size and gradients effects are same just like examples I have attached here, so there are any possibilities to make such kind of action to auto remove all background?

 

 

Thanks in advance

 

IMG_7676.jpgIMG_7749.jpgIMG_7840.jpg

FINAL RESULT that I want

 

 

 

final.jpg

photoshop scripting output

$
0
0

Is there a console or log for output from script events?  I tried making a function, which executes an alert correctly, but doesn't create a new document.  I can't find any way to see if this syntax is wrong or the command is just outdated. 

 

In the code below, for example, I see the alert message, but no new document.  I don't see anyway to see what's wrong with it and I pulled that line straight from the photoshop scripting guide. 

 

var createDocument = function() {

    alert("creating new doc!");

    app.documents.add(2,4);

};

Script I made: Iterate Action Over Layers

$
0
0

Hey, just cobbled together this script that I'm already finding useful in my own work, so I figured I'd share, and maybe see if anyone has suggestions for improvement.

What it does, is apply a selected action to each of the selected layers individually.

So for example, if you had 50 layers that you wanted to each rotate by 90 degrees in place, you'd record a rotate-by-90-degrees action, select all the layers you want to apply it to and run the script with the action selected.

 

 

#target photoshop


var scriptName = "NinjaScript IterateActionLayers";
var scriptVersion = "0002";


function cID (inVal) { return charIDToTypeID(inVal);}
function sID (inVal) { return stringIDToTypeID(inVal);}


var currentActionSets = getActionSets();


main();
function main()
{
    app.bringToFront();    optionsDialog();
}


function optionsDialog()
{
    var ButtonWidth = 100;     OpenOptionsDialog = new Window("dialog", scriptName + " v" + scriptVersion);  OpenOptionsDialog.orientation = 'column';  OpenOptionsDialog.alignChildren = 'left';    mainGroup = OpenOptionsDialog.add("group");    mainGroup.orientation = 'column';    mainGroup.alignChildren = 'left';    mainGroup.alignment = 'left';        var actionSetGroup = mainGroup.add("group");    actionSetGroup.orientation = 'row';    actionSetGroup.add("statictext",undefined, "ActionSet: ")    var DDActionSet = actionSetGroup.add("dropdownlist",undefined, "")    DDActionSet.preferredSize.width = 150;          for (var i = 0; i < currentActionSets.length; i++)    {            DDActionSet.add("item", currentActionSets[i]);    }    DDActionSet.selection = 0;                var actionGroup = mainGroup.add("group");    actionGroup.orientation = 'row';    actionGroup.add("statictext",undefined, "Action:      ")    DDActions = actionGroup.add("dropdownlist",undefined, "")    DDActions.preferredSize.width = 150;       function populateDDActions (inSet)    {        DDActions.removeAll();               for (var i = 0; i < currentActionSets[inSet].actions.length; i++)        {            DDActions.add("item", currentActionSets[inSet].actions[i]);        }        DDActions.selection = 0;    }    DDActionSet.onChange = function()    {        populateDDActions(DDActionSet.selection.index);    }    DDActionSet.onChange();       mainGroup.add("statictext", undefined, "");        ButtonGroup = mainGroup.add("group");    ButtonGroup.orientation = 'row';    ButtonGroup.alignChildren = 'center';    ButtonGroup.alignment = 'top';                   buttonRun= ButtonGroup.add("button",undefined, "Run")    buttonRun.preferredSize.width = ButtonWidth;    buttonRun.onClick = function()   {       var SelectedLayers = getSelectedLayers();              for (var i = 0; i < SelectedLayers.length; i++)        {            activeDocument.activeLayer = SelectedLayers[i];            doAction(DDActions.selection.text, DDActionSet.selection.text);                   }        OpenOptionsDialog.close()    }       buttonClose= ButtonGroup.add("button",undefined, "Exit")    buttonClose.preferredSize.width = ButtonWidth;    buttonClose.onClick = function() {OpenOptionsDialog.close()}          //Show window  OpenOptionsDialog.center();  var result = OpenOptionsDialog.show();
}


function getActionSets()
{   var i = 1;   var sets = [];   while (true) {     var ref = new ActionReference();     ref.putIndex(cID("ASet"), i);     var desc;     var lvl = $.level;     $.level = 0;     try {       desc = executeActionGet(ref);     } catch (e) {       break;    // all done     } finally {       $.level = lvl;     }     if (desc.hasKey(cID("Nm  "))) {       var set = {};       set.index = i;       set.name = desc.getString(cID("Nm  "));       set.toString = function() { return this.name; };       set.count = desc.getInteger(cID("NmbC"));       set.actions = [];       for (var j = 1; j <= set.count; j++) {         var ref = new ActionReference();         ref.putIndex(cID('Actn'), j);         ref.putIndex(cID('ASet'), set.index);         var adesc = executeActionGet(ref);         var actName = adesc.getString(cID('Nm  '));         set.actions.push(actName);       }       sets.push(set);     }     i++;   }   return sets; 
}; 


function getSelectedLayers()
{
  var resultLayers=new Array();  try{    var descGrp = new ActionDescriptor();    var refGrp = new ActionReference();    refGrp.putEnumerated(cID( "Lyr " ),cID( "Ordn" ),cID( "Trgt" ));    descGrp.putReference(cID( "null" ), refGrp );    executeAction( sID( "groupLayersEvent" ), descGrp, DialogModes.NO );    for (var ix=0;ix<app.activeDocument.activeLayer.layers.length;ix++){resultLayers.push(app.activeDocument.activeLayer.layers[ix])}    var desc5 = new ActionDescriptor();    var ref2 = new ActionReference();    ref2.putEnumerated( cID( "HstS" ), cID( "Ordn" ), cID( "Prvs" ) );    desc5.putReference( cID( "null" ), ref2 );    executeAction( cID( "slct" ), desc5, DialogModes.NO );  } catch (err) { }  return resultLayers;
}  
Viewing all 12244 articles
Browse latest View live


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