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

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


Layer Saver script no longer works in photoshop cc 2017

$
0
0

Absolutely gutted, nothing ever made in Photoshop ever came close to it and i have been using it for years

 

I know there is one in PS and another on GITHUB but nothing comes close to the original script

 

The things that set it apart was the fact that you could save layers with Prefixes and increment the files with hyphens and numbers such as MFOTL395 and it would merge visible and/or selected layers in to files and name them MFOTL395-01.jpg, MFOTL395-02.jpg and so on

 

You could also set it to save selected layers along with the top or bottom most layers, including smart objects and backgrounds

 

Please someone update this script so it works in PS CC 2017, i have it safe if anyone has the talent to do this, it works in CS6 and I think it works in CC 2015

 

I create t-shirt designs and have all the 13 colours of shirt at the bottom of my file and all the smart vector objects above, i can select all 13 blank coloured t-shirts and merge each one with a selected smart vector object and create all the colour variation images or ebay, amazon, my website etc in seconds for each design

 

OH GOD, OH NO

DropDownList value selected by default?

$
0
0

Hi there,

 

I've got the following DropDownList, but it gets rendered with no options selected. How can I make ''one" the default option for this element?

 

var w, layout;


layout = "dialog {  \    dropdown: DropDownList { \        size: [100,20] \        properties: { \            items: ['one','two','three'] \        } \    } \
}";


w = new Window(layout);
w.show();

 

Thanks

Reference Script from HTML Panel

$
0
0

So I have written my own HTML panel for personal use in Photoshop, but I can only get it to access .jsx scripts which are local to the directory of the panel's index.html file.  What I would really like it to be able to do is actually call scripts which are located in Photoshop's scripts folder located at:

C:\Program Files\Adobe\Adobe Photoshop CC 2017\Presets\Scripts

(on Windows).  This is because I want to create a panel that can access the SAME scripts that show up here:

HmnPft-BRSmRpg-ffs_JQg.png

As far as I understand it right now, HTML panels can only call .jsx scripts which are located in the:

C:\Program Files (x86)\Common Files\Adobe\CEP\extensions\PanelNamel\jsx

folder.

 

Summary:

How can I get custom HTML Photoshop panels to call scripts from:

C:\Program Files\Adobe\Adobe Photoshop CC 2017\Presets\Scripts

as opposed to from here:

C:\Program Files (x86)\Common Files\Adobe\CEP\extensions\PanelNamel\jsx

?

Action to run script with dialog box shown only once.

$
0
0

Hello,

 

I need to create an action, that runs the script. This script displays a dialog box, with various variables for user to select.

When I choose Automate > Batch and select this action, the dialog box appears for every image.

 

Is there any way to show the dialog box only once and apply the variables values set within this dialog box to the whole batch of images I want to process?

 

Thank you!

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

looking for a save as Targa script

$
0
0

Anyone could help me script a SAVE AS .TGA  file in a folder?

Reason I can't use action is that the tag file needs a new suffix (ex: image_01.tga... image_02.tga... image_03.tga)

 

I'm saving dozens of Targas everyday. so please please the one who could help me would be my hero for the rest of the year.

 

in short:

 

PSD file with layers, ---> save as .tga file with suffix 32 bit.

 

Thanks a million!

 

/Dominique

Add thumbnail to the user interface.

$
0
0

Hello everyone! How do I view the thumbnail of the active layer in a "ScriptUI" user interface?

thumbnail size 196 x 235 px

Is there any possibility? Thank you.

Dlg=new Window("dialog","My Dialog",[0,0,250,350],{closeButton: true});
View=Dlg.add("panel",[20,20,230,270]);
Thub=View.add("panel",[10,10,196,235]);
Thub.graphics.backgroundColor = Thub.graphics.newBrush (Thub.graphics.BrushType.SOLID_COLOR,[0.75,0.75,0.75]);
Thu_layer=Thub.add("statictext",[40,90,160,130] ,"Thumbnail On here",{multiline:true});
Thu_layer.graphics.foregroundColor = Thu_layer.graphics.newPen (Thu_layer.graphics.PenType.SOLID_COLOR,[0,0,0], 1);
nm_lay=Dlg.add("statictext",[20,290,85,310] ,"Name layer",{multiline:true});
id_lay=Dlg.add("edittext",[85,287,225,307] ,"   Active Layer");


Dlg.center();
Dlg.show();

Davide Barranca Extension Panel Question

$
0
0

The only extension I have CC install  is JSX Launcher.  In CC version before CC 2018 I was able to resize it extension Panel. In CC 2018 it seem to open som size the resize itself to a fixed size  that I can not resize.  Is the a bug or a new restriction for extension panels.

Capture.jpg]

rename layerset (group) to active document name

$
0
0

Hi, complete noob here.

 

I have a script that renames a layer to the current file name:

 

#target photoshop

activeDocument.activeLayer.name=activeDocument.name;

 

I am now after a script that renames a layer set (group) to the current file name.

 

I've searched online but I know too little to get anything working . Any help would be much appreciated.

sampled colors in color range is not recorded by scripts

$
0
0

When i used color range ,the default selected model is highlight,but i used color range with sampled colors model  by scripts in next time ,it stil show the result that is

highlight model.I dont konw why?  please help ,thanks!

 

cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };    var desc1 = new ActionDescriptor();    desc1.putInteger(cTID('Fzns'), 80);    var desc2 = new ActionDescriptor();    desc2.putDouble(cTID('Lmnc'), 48.58);    desc2.putDouble(cTID('A   '), -9.14);    desc2.putDouble(cTID('B   '), -45.14);    desc1.putObject(cTID('Mnm '), cTID('LbCl'), desc2);    var desc3 = new ActionDescriptor();    desc3.putDouble(cTID('Lmnc'), 60.86);    desc3.putDouble(cTID('A   '), -4.64);    desc3.putDouble(cTID('B   '), -40.1);    desc1.putObject(cTID('Mxm '), cTID('LbCl'), desc3);    desc1.putInteger(sTID("colorModel"), 0);    executeAction(sTID('colorRange'), desc1, DialogModes.NO);

I try to add"desc1.putEnumerated(cTID('Clrs'), cTID('Clrs'), sTID("sampledColors"));"before in"desc1.putInteger(sTID("colorModel"), 0);",but it has error

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?

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?

Photoshop CC 2018 Freezes When Running Scripts

$
0
0

I have two simple scripts that split one text layer into multiple text layers. One creates a new text object for every character, one creates a new text object for every word (characters separated by a space). These scripts functioned as intended in previous versions of Photoshop. With the 2018 update, Photoshop will sometimes lock up when I use these scripts, necessitating a force close with Task Manager.

 

Here is an example. Text layer before script:

2017-11-06 17_56_09-Untitled-1 @ 100% (Lorem ipsum, RGB_8) _.png

Text layers after script (intended):

2017-11-06 17_56_29-Untitled-1 @ 100% (Lorem, RGB_8) _.png

Text later after script (Photoshop freezes):

2017-11-06 17_56_40-Untitled-1 @ 100% (Lorem ipsum, RGB_8) _.png

When Photoshop freezes, toolbar, menu, and tool buttons can be clicked, but do not do anything. The layer panel is completely frozen, which I think might be related to the cause. Text becomes selected, cannot be unselected. No layers are created, the base layer is just edited. This issue does not always occur; it seems more likely to happen the longer Photoshop has been open.

 

Was something changed in the 2018 update with regard to scripting? If so, what do I have to change to fix my script? Or is there some problem with Photoshop itself?

 

Here is the script being used:

 

doc = app.activeDocument;
layer = doc.activeLayer;


var text = layer.textItem.contents;
var textArray = text.split(" ") || text.split("/r");


var pos = layer.textItem.position;
var sze = layer.textItem.size;
var DPI = app.activeDocument.resolution;


layer.textItem.contents = textArray[0];
layer.name = textArray[0];


for (var k=1; k<textArray.length; k++){    tmp = layer.duplicate();    tmp.textItem.position = [pos[0]+(Number(sze)*Number(DPI)*k*.015), pos[1]];    tmp.textItem.contents = textArray[k];
}

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


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

Increment Opacity and Flow

$
0
0

I'm trying to make a script to increment Opacity and Flow. I jumbled together the script fromRe: Is it possible to script brush opacity?  and Re: brush opacity for scripting

 

Opacity Increment:

function SetPaintBrush(opacity) {     var idset = stringIDToTypeID( "set" );     var desc226 = new ActionDescriptor();     var idnull = stringIDToTypeID( "null" );     var ref170 = new ActionReference();       var idPbTl = stringIDToTypeID( "paintbrushTool" );       ref170.putClass( idPbTl );       desc226.putReference( idnull, ref170 );       var id12 = stringIDToTypeID( "to" );       var desc5 = new ActionDescriptor();       // opacity       var id13 = stringIDToTypeID( "opacity" );       var id14 = stringIDToTypeID( "percentUnit" );     desc5.putUnitDouble( id13, id14, opacity );         var id18 = stringIDToTypeID( "null" );       desc226.putObject( id12, id18, desc5 );     executeAction( idset, desc226, DialogModes.NO );     }   
function BrushOpacityGet() 
{   var ref = new ActionReference();   ref.putEnumerated(charIDToTypeID("capp"),                      charIDToTypeID("Ordn"),                      charIDToTypeID("Trgt")                     );    var AD = executeActionGet(ref);   AD = AD.getObjectValue(stringIDToTypeID("currentToolOptions"));   return(AD.getInteger(stringIDToTypeID("opacity"))); 
}   
opacity = BrushOpacityGet(); 
var op = opacity+5; 
SetPaintBrush(op); 

Flow Increment:

 

 

function SetPaintBrush(flow) {     var idset = stringIDToTypeID( "set" );     var desc226 = new ActionDescriptor();     var idnull = stringIDToTypeID( "null" );     var ref170 = new ActionReference();       var idPbTl = stringIDToTypeID( "paintbrushTool" );       ref170.putClass( idPbTl );       desc226.putReference( idnull, ref170 );       var id12 = stringIDToTypeID( "to" );       var desc5 = new ActionDescriptor();       // flow       var id14 = stringIDToTypeID( "percentUnit" );     var id19 = stringIDToTypeID( "flow" );     desc5.putUnitDouble( id19, id14, flow );       var id18 = stringIDToTypeID( "null" );       desc226.putObject( id12, id18, desc5 );     executeAction( idset, desc226, DialogModes.NO );     }   
function BrushOpacityGet() 
{   var ref = new ActionReference();   ref.putEnumerated(charIDToTypeID("capp"),                      charIDToTypeID("Ordn"),                      charIDToTypeID("Trgt")                     );    var AD = executeActionGet(ref);   AD = AD.getObjectValue(stringIDToTypeID("currentToolOptions"));   return(AD.getInteger(stringIDToTypeID("flow"))); 
}   
flow = BrushOpacityGet(); 
var flo = flow+5; 
SetPaintBrush(flo); 

It almost works, but there's two major issues on the script

1. It turns on Shape Dynamics and Scattering and turns off any other parameters (Transfer, Dual Brush, etc.)

2. The script is pretty slow the first time it runs

 

Anyone know what is causing this, and how to fix it?

Any help will be appreciated!

[Q] Set Brush Smoothing value by script (CC 2018 feature)

$
0
0

Hi all,

 

I'm struggling to set value on Brush's Smoothing on Photoshop UI part as below.

20171107_brush_param.png

 

From XTools' Getter.jsx file, it seems Smoothing is exported as following as same level of Opacity and Flow.

XTools: xtools

 

So I tried to modify from code from changing Opacity from following and the modified code.

JavaScripts/SetPaintBrushOpacityAndOthers.jsx at master · TomRuark/JavaScripts · GitHub

 

 

// Code from : 
// https://github.com/TomRuark/JavaScripts/blob/master/SetPaintBrushOpacityAndOthers.jsx


var idset = stringIDToTypeID( "set" );
var desc226 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref170 = new ActionReference();
var idPbTl = stringIDToTypeID( "paintbrushTool" );
ref170.putClass( idPbTl );
desc226.putReference( idnull, ref170 );
var id12 = stringIDToTypeID( "to" );
var desc5 = new ActionDescriptor();

// opacity
var id13 = stringIDToTypeID( "opacity" );
var id14 = stringIDToTypeID( "percentUnit" );
desc5.putUnitDouble( id13, id14, 88 );

// flow
var id19 = stringIDToTypeID( "flow" );
desc5.putUnitDouble( id19, id14, 77 );

// TEST: smoothing: Not working
var id99 = stringIDToTypeID( "smooth" );
desc5.putUnitDouble( id99, id14, 66 );

var id18 = stringIDToTypeID( "null" );
desc226.putObject( id12, id18, desc5 );
executeAction( idset, desc226, DialogModes.NO );


 

Opacity and Flow can be set the value.

Smoothing is not working.

 

I still don't understand well on the ActionDescriptor's code and still learning.

Any help, suggestions, tips, links are appreciated.

 

Thank you,

Naoki

JS Scripting the Quick Selection Tool

$
0
0

Using the ScriptListener plug-in, I see that making a selection with the Quick Selection Tool produces this code:

 

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

var idslct = charIDToTypeID( "slct" );

    var desc3 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref1 = new ActionReference();

        var idquickSelectTool = stringIDToTypeID( "quickSelectTool" );

        ref1.putClass( idquickSelectTool );

    desc3.putReference( idnull, ref1 );

executeAction( idslct, desc3, DialogModes.NO );

 

 

This makes sense. But, I don't see how the location of the selection I made is passed into the ActionDescriptor (desc3) used for the executeAction() call.

 

Basically, I would like to be able to programmatically set the location of a Quick Selection, in JS.

 

Any tips for how to set that information into the ActionDescriptor?

(Or...is it not possible to set that info for a tool like Quick Selection?)

 

Thanks++

Add thumbnail to the user interface.

$
0
0

Hello everyone! How do I view the thumbnail of the active layer in a "ScriptUI" user interface?

thumbnail size 196 x 235 px

Is there any possibility? Thank you.

Dlg=new Window("dialog","My Dialog",[0,0,250,350],{closeButton: true});
View=Dlg.add("panel",[20,20,230,270]);
Thub=View.add("panel",[10,10,196,235]);
Thub.graphics.backgroundColor = Thub.graphics.newBrush (Thub.graphics.BrushType.SOLID_COLOR,[0.75,0.75,0.75]);
Thu_layer=Thub.add("statictext",[40,90,160,130] ,"Thumbnail On here",{multiline:true});
Thu_layer.graphics.foregroundColor = Thu_layer.graphics.newPen (Thu_layer.graphics.PenType.SOLID_COLOR,[0,0,0], 1);
nm_lay=Dlg.add("statictext",[20,290,85,310] ,"Name layer",{multiline:true});
id_lay=Dlg.add("edittext",[85,287,225,307] ,"   Active Layer");


Dlg.center();
Dlg.show();
Viewing all 12244 articles
Browse latest View live


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