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

ライブラリーに送っていたスマートオブジェクトのリンク解除方法は?

$
0
0

Photoshop CC(2015)のアップデート後から、PSDを開くとスタイル要素をライブラリで生成してくれる機能が追加されたと思います。

間違ってライブラリ化して、ライブラリを削除したのですが、

元のPSDのスマートオブジェクトがクラウドスマートオブジェクト化されて、

ライブラリに存在してない為、編集できない状況になっております。

 

そこでご質問とご意見ですが、

・クラウドスマートオブジェクト化されているベクトルスマートオブジェクトを普通のスマートオブジェクトに戻す方法はありますか?

PSDを開くとスタイル要素をライブラリで生成してくれる機能のポップアップ→Enterキーを押すと生成するになってしまうので、

 デフォルトをキャンセルにできるようにできないでしょうか?そんな頻繁に行う機能でもないと思いますが。。。

 

解決案などご存知の方は教えていただければと思います。

どうぞ、よろしくおねがいいたします。


Layer Comps to JPG Save for Web

$
0
0

Hello everyone,

 

I'm using the "Layer comp to files" script a lot to send some designs to clients. And sometimes I need to send a lot of JPGs at once, wich are created with "Layer comps to files", but they are all around 300k or more, and when I use Safe for web it reduces the file size a lot! But I don't want todo it all manually again offcourse.

 

So I was wondering, is there any script what saves your Layer Comps JPGs to a JPG what is compressed with the Save for Web technology?

 

Thanks in advance.

 

 

Jeroen

Is there any way to get active layer comp in JSX?

$
0
0

I want go get currently active layer comp.

Is there any way to that?

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;
}  

Photoshop CC 2018 - extended script - View mode issue

$
0
0

Dear Photoshop forum,

 

I’m noticing an issue with Photoshop CC 2018 and the extended script “.jsx” file I developed for Photoshop CC 2017.

 

My script works perfectly in Photoshop CC 2017 and both it's view modes “Standard screen mode” and “Full screen mode with menu bar”. In Photoshop CC 2017 I can launch the script and it returns a dialog that can be changed and its changes return a dialog with the corresponding changes.

 

In Photoshop CC 2018 my extended scripts works perfectly fine while in  the “Standard screen mode”. But while I’m in the “Full screen mode with menu bar” the dialog goes blank. When I move the mouse over the dialog some of its interface items are brought back but the majority of it remains blank. If I change a menu item that is shown by the mouse it makes the appropriate modifications.

 

It appears that the dialog's interface is being overwritten by the “view modes” white background while in “Full screen mode with menu bar”.

 

Is there something I need to add to my script so that it works properly?

 

Thanks

Rob

 

Screen Shot 2017-10-22 at 8.58.45 AM.png

Rename layer

$
0
0

Good morning friends! How do I delete the current name of the active layer when replacing with the name entered in the text field of the dialog box? What is missing, where am I going wrong?

 

#target photoshop
var doc = activeDocument;
app.preferences.rulerUnits = Units.CM;
function layerNamer() {
var opts = new Object();
win=new Window("dialog","Replace Layer Name",[0,0,300,100],{resizeable:true,});
text01=win.add("statictext",[20,30,110,50] ,"Type something:")
text02=win.add("edittext",[110,30,250,50] ,"")
but_1=win.add("button",[110,58,197,78],"Replace Layer Name");

but_1.onClick = function() {
opts.replace = text02.text;
processDoc(opts);
}

win.center();
win.show();
};
if ( app.documents.length > 0) { layerNamer(); }
function processDoc(opts) {     var find;     if ( opts.global && !opts.ignore ) { find = new RegExp(opts.find,'gi'); }      if ( !opts.global && !opts.ignore ) { find = new RegExp(opts.find,'i'); }      var doc = app.activeDocument;      recurseLayers(doc.layers);      function recurseLayers(layObj) {      for ( var i = 0; i < layObj.length; i++ ) {               if ( find.test(layObj[i].name) )                   {                         if (layObj[i].kind == LayerKind.TEXT && !opts.txtLay) { continue; }                         layObj[i].name = layObj[i].name.replace(find,opts.replace);                    }              if ( layObj[i].typename == 'LayerSet' )                    { recurseLayers(layObj[i].layers); }            }      }  };

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?

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


Question about characters in statictext in dialog box!

$
0
0

How do I get only 3 numbers, (maximum 2 numbers after the dot) in statictext?

#target photoshop 
var doc = activeDocument; 
app.preferences.rulerUnits = Units.CM;  
dlg = new Window('dialog','Final Width Size'); 
dlg.gp = dlg.add('group'); 
dlg.gp.stxt = dlg.gp.add('statictext',undefined,'Width Size'); 
dlg.gp.etxt = dlg.gp.add('statictext {text: "Centre", characters: 3, justify: "center"}');


dlg.btn = dlg.add('button',undefined,'Close');   dlg.gp.etxt.text =(doc.width)*1;  
dlg.btn.onClick = function (){     dlg.close();     }  
dlg.show();

Screenshot_3.jpg

I thought that would solve:

('statictext {text: characters: 3}');

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);

};

Rename the current active file?

$
0
0

I'm wanting a script to be able to rename open Photoshop files, if possible.

 

I cobbled this together from an existing script:

 

tellapplication "Adobe Photoshop CS5"

  activate

          setold_nametonameofcurrent document

          setdialog_resulttodisplay dialog¬

                    "Rename active document:" default answer (old_name) ¬

                    buttons {"Cancel", "Rename"} default button 2 ¬

  with iconnote

          ifbutton returnedofdialog_result = "Rename" then

                    setnew_nametotext returnedofdialog_result

                    setdtopropertiesofcurrent document

                    ifpathofdisequal tomissing valuethen

                              setnameofcurrent documenttonew_name

                    else

                              tellmetosetthe_filetoPOSIX file (d's pathastext) asalias

                              tellapplication "Finder"

                                        setnameofthe_filetonew_name

                              endtell

                    endif

          endif

endtell

 

If I run it it shows the dialogue window, but when I enter the new name and hit Return it throws out lots of errors.

 

Is something like this possible?

Image Processor Pro 3.2b1 beta released

$
0
0

Image Processor Pro 3.2b1 beta has been released can be found here: ps-scripts - Browse /Image Processor Pro/v3_2b1 at SourceForge.net

 

This port is compatible with PS CS5 through CC2015. Besides the port, a few more requested features are being added.

 

If you find any problems or have any requests, post them here or email me at the address in the README file.

 

-X

saveAs DSC2.0 Not working properly

$
0
0

   Hello I am having some trouble getting Photoshop CC2017 to do what i need.
   I am writing an automation script and I need to save a document via DCS2 format ...
    I am inputing all the correct options into the saveOptions object , however photoshop is outputting 1 file instead of 4
    When i try to save the same document in DCS2 mode manually it works fine ...
    ... Yes I am passing the multiFileDCS option as true to the save options object in my script ...

 

          function SaveDoc(file){
                    var doc = app.activeDocument;
                    var options = new DCS2_SaveOptions();

                    options.multiFileDCS = true;

                    var path = '/User/Desktop/'+file

                    doc.saveAs(new File(path , options)
      }

 

... The file is saved BUT it is only 1 file , instead of 4 ... If anyone could offer some advice i would greatly appreciate it !
JJMack , you are the Photoshop master, can you offer any wisdom sir ?

Add subpath to existing path

$
0
0

I need to add a subpath to an existing path. The SubPathItems object doesn't provide the add method, so to add the subpath I create a new path that includes old subpaths and the new one, and then delete the old path. This causes flickering and doesn't look like the best solution.

 

Is there a better way to add a subpath to an existing path?

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


[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

Keeping variables across runs of a script

$
0
0

Well, I'm a noob at Photoshop scripting. I knew Javascript, and I've been trying to work my way with the Photoshop DOM for about a month, but now I'm trying to do something that I can't find anywhere, neither in Google nor in the documentation... Sorry if this sounds obvious.

 

First I'm asking to open a PDF file, and then I ask to select a folder where the pages will go. Then I save in an array the file object for the PDF, the folder object, the current page... so I can get it later. Now I open the first page, and stop the script to do some manual work. After that, I would load the script, check if the array where I saved that exists, and if it does, save that page and open the next.

 

Now, I can't find any way to keep variables between runs of a script, nor to keep the script waiting in the background. Somewhere in the Javascript reference it says that the variables are kept, but every time it asks me to select the PDF again. So I'm kind of lost there. Could you help me?

 

By the way, I'm using Photoshop CS5, and I script with Javascript.

Import document from a folder

$
0
0

Hello pessola It would be possible for a jsx capable of importing in a stack form all the files of a folder, eg: (~ / Desktop / Images) to the active document.

Each file added would be a layer with the name corresponding to the file name

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

Export selected groups as png files

$
0
0

Hello

 

I need a way to automaticly export png images from selected layers or groups.

The way I would like script to work is simple:

Before: Select layers/grous you want to export (selected groups\layers may be inside other grouops)

After: List of transparent png images (with exact size of layer/group content) named with source layer/group.

 

I have found a code to export groups to files, all I need is a little bit help modyfing script for my needs.

http://www.damienvanholten.com/blog/export-groups-to-files-photoshop/

Viewing all 12244 articles
Browse latest View live


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