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

Is there any way to create editable table in a JSX dialog box?

$
0
0

I have created a table in JSX dialog box using multiple column list as follows.

var dlg = new Window("dialog", "Animation List");
dlg.frameLocation = [100,100]; // position
dlg.size = [750, 250];


//table initailize
var w0=150, w1=150 ;
   
 table = dlg.add ("listbox", {x:20, y:20, width:300, height:150}, undefined, { numberOfColumns:6, showHeaders:true,
 columnWidths: [w0,w1],
 columnTitles:["First Name", "Last Name"] });


table.add("item", "Namodaya");
table.items[0].subItems[0].text = "Balaarachchi";
 
 dlg.show();

 

Output table:

3.PNG

But I want to edit the cells in the table. Is there any way to achieve this?


Passing arguments to the jsx file from command line

$
0
0
Thanks for taking my question.

I am using the following to be able to run my script from the command line.In case you were wondering on why i would be doing this- i would need to invoke the javascript from a server side code(like java,php etc. in my case it is java)

"c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx"

Anyways, i have been successful in running the myscript.jsx from the command line but i am not able to figure out how i could pass arguments to "myscript.jsx" from the command line, and be able to refer to these arguments within the script.

I have tried the following

"c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx" "argument1" "argument2"

and tried to refer these arguments within the script using arguments[0] and arguments[1] . But looks like this does not work.

Any thoughts?????

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

Script for deleting Hidden Layers which are not used in any Layer Comp?

$
0
0

Hello.

 

I've turend the web upside down searching for a script that would do the following:

 

  1. Search through all the layer comps in the document
  2. Check which layers are hidden on all Layer Comps
  3. Remove/mark with color the layers found.

 

If anybody can provide a script that would do such a thing - it would be highly appreciated.

 

Regards,

Fade.

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.

Using mouse wheel to zoom and pan

$
0
0
I was wondering if there would be a way to make a javascript that would load at Photoshop's startup that would allow the user to zoom in and out using the mouse wheel (instead of using it for scrolling), and to use that same mouse wheel as a third button (when you push on the mouse wheel) or any third button on a three button mouse to pan in your image. I'm a 3ds max user and I love the way the navigation work in that software so it'd be great to be able to do that for Photoshop and Illustrator and get rid of those useless key shortcuts that we need to use to zoom and pan.

For the pan fonction, I guess if there was a way to simply say "when the third mouse button is pressed, press the space button, until the mouse button is released" it could work. But then it would force the panning to stop when the mouse goes offscreen, unlike in 3ds max where you can pan for whatever distance you want, even if you have the loop throught the screen ten times.

For the zoom function, if scolling up could simply "push" the keyboard shortcuts to zoom in/ zoom out it could work, but I don't know if that's possible. And then we'd have to disable the scrolling up and down in the document.

Anyways, if anyone has any ideas about that let me know! I've been looking for that for such a long time!

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!

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!


Layer Comps to Files flatten tiff

$
0
0

Can anyone provide a modification to the javascript Layer Comps to Files that will add a checkbox option to save as a flattened TIFF? Or it could just be a script that executes the save as TIFF format with no layers, just like the option in Save As. I know I can do a workaround to flatten the layered TIFF files the script saves, but it would save a lot of time if that feature was built into the script. My layered files are big enough that reprocessing the large layered TIFF files is an added step I would like to avoid.

Refresh in a dialog box:

$
0
0

Hello friends! Would it be possible to update a dialog box without having to close it and reopen it? I modified a script and made an example using two documents with different images:

#target photoshop;     
StartDialog();///Start Dialog
function StartDialog() {


app.bringToFront();   Image.prototype.onDraw = function() {      if (!this.image) return;    var WH = this.size,        wh = this.image.size,        k = Math.min(WH[0] / wh[0], WH[1] / wh[1]),        xy;    //Resize proportionally:         wh = [k * wh[0], k * wh[1]];    //Align image    xy = [(WH[0] - wh[0]) / 7, (WH[1] - wh[1]) /90];    this.graphics.drawImage(this.image, xy[0], xy[1], wh[0], wh[1]);    WH = wh = xy = null;
}   function promoteBackgroundLayer() {   var doc = activeDocument;   var layers = doc.layers;   var layer = layers[layers.length - 1];   if (layer.isBackgroundLayer) {   layer.name = 'Background';}        }        if (documents.length) {   promoteBackgroundLayer();}             /////////////////// 
if(documents.length) main();     
function main(){     
var OutputFolder =Folder(Folder.temp);   
if(!OutputFolder.exists) OutputFolder.create();   
var LayerName = activeDocument.activeLayer.name;     
dupLayers();     
app.activeDocument.trim(TrimType.TRANSPARENT);     
var saveFile = File(OutputFolder + "/temp.png");     
if(activeDocument.width > activeDocument.height){ 
activeDocument.resizeImage(UnitValue(150, "px"), undefined, undefined, ResampleMethod.BICUBIC); //196 x 235  
}else{     activeDocument.resizeImage(undefined,UnitValue(227, "px"), undefined, ResampleMethod.BICUBIC);     } 
SavePNG(saveFile);     
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);      

function SavePNG(saveFile){         pngSaveOptions = new PNGSaveOptions();      
activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);      
}     
function dupLayers() {      
var desc143 = new ActionDescriptor();     
var ref73 = new ActionReference();     
ref73.putClass( charIDToTypeID('Dcmn') );     
desc143.putReference( charIDToTypeID('null'), ref73 );     
desc143.putString( charIDToTypeID('Nm  '), activeDocument.activeLayer.name );     
var ref74 = new ActionReference();     
ref74.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );     
desc143.putReference( charIDToTypeID('Usng'), ref74 );     
executeAction( charIDToTypeID('Mk  '), desc143, DialogModes.NO );
}


Dlg=new Window("dialog","My Dialog",[0,0,250,350],{closeButton: true});   
View=Dlg.add("panel",[20,20,230,270]);   
Thub=View.add("panel",[18,10,191,239]);   
Thub.graphics.backgroundColor = Thub.graphics.newBrush (Thub.graphics.BrushType.SOLID_COLOR,[0.75,0.75,0.75]);   
Thu_layer_image = Thub.add ("image", [-2,-5,185,233], File (saveFile));


Thu_layer_image.graphics.foregroundColor = Thu_layer_image.graphics.newPen (Thu_layer_image.graphics.PenType.SOLID_COLOR,[0,0,0], 1);   
nm_lay=Dlg.add("statictext",[70,270,250,310] ,LayerName);   


NextDoC = Dlg.add('button',[42,310,200,310],'Next Image Dialog',{name:'ok'}); 
/////////////
NextDoC.onClick = function() {
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putOffset( stringIDToTypeID( "document" ), 1 );
descriptor.putReference( charIDToTypeID( "null" ), reference );
descriptor.putInteger( stringIDToTypeID( "documentID" ), 1691 );
executeAction( stringIDToTypeID( "select" ), descriptor, DialogModes.NO );
Dlg.close(); 
StartDialog(); ///Start Dialog


}




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


}

 

My video shows that the images load, but only when the dialog box is executed again:

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.

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?

Help with Photoshop script: how to iterate through all open documents?

$
0
0

Hello,

 

I'm very new to Javascript, and scripting in Photoshop especially. I'm trying to create a script that does the following:

 

  1. Iterates through all open PSDs in Photoshop
  2. Checks for paths.
  3. Checks path at first state -- [0].
  4. First checks if that path is a work path. If so, renames work path to "Path 1" and creates clipping path set to .2 flatness.
  5. If not work path, then checks if the path is not a clipping path. If it isn't, sets path as clipping path set to .2 and renames it "Path 1" if needed.
  6. If path is a clipping path already, sets it to .2 flatness and renames to "Path 1" if needed.

 

Basically, the idea here is that any path at the top of the path list in the paths panel, whether a work path or a regular path, needs to become a clipping path set with .2 flatness and renamed to be Path 1.

 

I've gotten this far (script below), but I would like to now have this script iterate through all open documents. Is there a way I can accomplish this with what I've written so far? Again, I'm very new, and I've written this script in a way that I can follow -- I'm sure there are instances where I can consolidate and remove duplicate code. If there is a way to have this iterate through all open documents, I would really appreciate any advice and help. Thank you!

 

var docRef = app.activeDocument;

if (app.documents.length > 0) {    var n = docRef.pathItems.length;    //If path at state [0] is a "work path," rename as "Path 1" and make into a clipping path set to .2    if ((n > 0) && (docRef.pathItems[0].kind == PathKind.WORKPATH)) {        docRef.pathItems.getByName("Work Path").name = "Path 1";        docRef.pathItems[0].makeClippingPath(.2);    //If path at state [0] is not a clipping path, make into clipping path set to .2 and rename as "Path 1," if needed.    //"Work paths" and regular paths needed to be treated differently, so I have it check for work path prior to this step.    //Also, I kept getting a popup to rename the path if it was already named "Path 1," the second if statement seems to avoid that.    } else if ((n > 0) && (docRef.pathItems[0].kind != PathKind.CLIPPINGPATH)) {        docRef.pathItems[0].makeClippingPath(.2);        if (docRef.pathItems[0].name != "Path 1") {            docRef.pathItems[0].name = "Path 1";        };    //If path at state [0] is a clipping path, set to clipping path .2 and rename as "Path 1," if needed.    } else if ((n > 0) && (docRef.pathItems[0].kind == PathKind.CLIPPINGPATH)) {        docRef.pathItems[0].makeClippingPath(.2);        if (docRef.pathItems[0].name != "Path 1") {            docRef.pathItems[0].name = "Path 1";        };    };
};

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

onClick = function () {a (i);}; I want to repeat processing with variables

$
0
0

Hello, I usually do animation etc in python.

Please kindly advise. OS windows 7 software PhotoshopCC

It is not English - speaking countries.

 

I am using photoshop at work, but I've recently started making photoshop script, trying to make a simple script that opens a template that I always use. I can create a scriptUI that opens with an arbitrary button, but I want to organize the increasing number of buttons by iterating. However, it does not work.

 

 

button0.onClick = function(){openfile (0);};  // ← I want to repeat this by iteration

button1.onClick = function(){openfile (1);};

button2.onClick = function(){openfile (2);};

:

:

 

 

Below is the actual script. Buttons will appear, but nothing will happen when pressed.

 

filePath = [
"C:\\Users\\staff\\Desktop\\templateA.psd",
"C:\\Users\\staff\\Desktop\\templateB.psd",
"C:\\Users\\staff\\Desktop\\templateC.psd",
"C:\\Users\\staff\\Desktop\\templateD.psd"]; // File path

win = new Window("dialog", "title"); // Wind, button creation
btn0 = win.add("button", {width: 80, height: 25, x: 40, y: 25}, "templateA");
btn1 = win.add("button", {width: 80, height: 25, x: 40, y: 25}, "templateB");
btn2 = win.add("button", {width: 80, height: 25, x: 40, y: 25}, "templateC");
btn3 = win.add("button", {width: 80, height: 25, x: 40, y: 25}, "templateD");

for (var i = 0; i <filePath.length; i ++){    bNo = "btn" + i.toString();    bNo.onClick = function(){opnFile(i);};
}

win.show(); // button window appearance

 function opnFile(btNo){
    filename = new File(filePath [btNo]);    open(filename); // Open the file    win.close();
};

 

It works fine if it is below

 

filePath = [
"C:\\Users\\staff\\Desktop\\templateA.psd",,
"C:\\Users\\staff\\Desktop\\templateB.psd",,
"C:\\Users\\staff\\Desktop\\templateC.psd",
"C:\\Users\\staff\\Desktop\\templateD.psd"]; // File path

win = new Window ("dialog", "title"); // Wind, button creation
btn0 = win.add ("button", {width: 80, height: 25, x: 40, y: 25}, "templateA");
btn1 = win.add ("button", {width: 80, height: 25, x: 40, y: 25}, "templateB");
btn2 = win.add ("button", {width: 80, height: 25, x: 40, y: 25}, "templateC");
btn3 = win.add ("button", {width: 80, height: 25, x: 40, y: 25}, "templateD");

btn0.onClick = function(){ opnFile(0); };       //Button action definition
btn1.onClick = function(){ opnFile(1); };
btn2.onClick = function(){ opnFile(2); };
btn3.onClick = function(){ opnFile(3); };

win.show(); // button window appearance

 function opnFile(btNo){
    filename = new File(filePath [btNo]);    open(filename); // Open the file    win.close();
};

 


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

How can I get this script/action to run?

$
0
0

I've been using this script and action for years. Got a new Mac and now I get the attached error.

 

Here's the process:

  • Action that first deletes alpha channels,
  • Then un-does any clipping paths
  • Call this script (which has a specific file hierarchy it needs).
  • Then I get the attached error
  • Photoshop CC 2018 19.0
  • OS X 10.12.6

Any thoughts? Thanks!

 

Capto_Capture 2017-11-17_09-52-47_AM.png

// Pfade übernehmen v2.1

// Copyright Thamer Florian

// 30.11.2010

 

var docRef = app.activeDocument;

var docJPG= app.activeDocument;

 

 

// Check for a "TIF","PSD","JPG" Subdirectory, which contains the Images where the paths should be applied to.

 

 

var checksum = "0";

for( var i = "1"; i <= "3"; i++){

 

if( i == "1" ) {

var newpath = docRef.path + "/TIF/";

newpath = new File(newpath);

if(newpath.exists) {

checksum++;

var dateityp = "TIF";

}

}

 

if( i == "2" ) {

var newpath = docRef.path + "/PSD/";

newpath = new File(newpath);

if(newpath.exists) {

checksum++;

var dateityp = "PSD";

}

}

 

if( i == "3" ) {

var newpath = docRef.path + "/JPG/";

newpath = new File(newpath);

if(newpath.exists) {

checksum++;

var dateityp = "JPG";

}

}

 

}

 

if( checksum > "1") alert("Error! please create a single tif, psd or jpg subfolder"); // Error if there is more than one possible subdirectory

if( checksum < "1") alert("Error! No tif, psd or jpg subfolder available"); // Error if there is no possible subdirectory

 

 

 

if( checksum == "1") { // The Script will only run if there is exacly ONE compatible subdirectory

 

// open the TIF/PSD/JPG file with the same name as the JPG

 

var jpg = docRef.name;

var fname = docRef.name.split(".");

 

var fname1 = "";

 

for (var k = 0; k <= fname.length - 2; k++) {

fname1 = fname1 + fname[k] + ".";

}

 

var fnamenew = fname1 + dateityp;

var newpath = docRef.path + "/" + dateityp + "/" + fnamenew;

 

var docRef = app.activeDocument;

var TIF = newpath;

 

// Opening the TIF/PSD/JPG file

var TIFShortcut = new File(TIF);

if( !TIFShortcut.exists ) {

alert("Oops! File " + TIFShortcut + " not found!" + jpg + " remains open"); // if the file does not exist stop scripts

}

else {

var docTIF = open(TIFShortcut);

 

// Check Resolution/Canvas size

 

app.activeDocument = docJPG;

if( docTIF.resolution != docJPG.resolution ) var sizeerr = "";

if( (docTIF.width != docJPG.width) || (docTIF.length != docJPG.length) ) var sizeerr = "";

if (sizeerr != null) {

alert("Document Size / Resolution different! \ NThe file" + jpg + " has a wrong document size / resolution. \  It will remain open");

docTIF.close();

}

else {

// Check color mode, color profile and bits per channel, and correct them

if( docTIF.mode != docJPG.mode ) docJPG.convertProfile(docTIF.colorProfileName, Intent.RELATIVECOLORIMETRIC, true, true);

 

if( docTIF.colorProfileName != docJPG.colorProfileName ) docJPG.colorProfileName = docTIF.colorProfileName;

 

if( docTIF.bitsPerChannel != docJPG.bitsPerChannel) docJPG.bitsPerChannel = docTIF.bitsPerChannel;

 

 

// So this is where i copy all the layers from the e.g. TIF to the JPG with paths

 

// I use the Select All Layers Command (cmd+alt+A - as far as i know not accessible through a menu)

 

// Problem is: It select all Layers EXCEPT the background layer

 

// So if there is a BG Layer i convert it to a normal layer first and rebackgroundize it afterwards.

 

 

app.activeDocument = docTIF;

 

var ebenen = docTIF.artLayers.length-"1";

 

 

if (docTIF.artLayers[ebenen].isBackgroundLayer == true) {

           docTIF.artLayers[ebenen].isBackgroundLayer = false;

           var hgset = "1";

}

 

 

// Select all layers

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

var idselectAllLayers = stringIDToTypeID( "selectAllLayers" );

var desc14 = new ActionDescriptor();

var idnull = charIDToTypeID( "null" );

var ref8 = new ActionReference();

var idLyr = charIDToTypeID( "Lyr " );

var idOrdn = charIDToTypeID( "Ordn" );

var idTrgt = charIDToTypeID( "Trgt" );

ref8.putEnumerated( idLyr, idOrdn, idTrgt );

desc14.putReference( idnull, ref8 );

executeAction( idselectAllLayers, desc14, DialogModes.NO );

 

// DRAG all layers to the other document, this increases speed, cause nothing goes into clipboard

 

// and I don't copy layer by layer.

 

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

var idDplc = charIDToTypeID( "Dplc" );

var desc50 = new ActionDescriptor();

var idnull = charIDToTypeID( "null" );

var ref40 = new ActionReference();

var idLyr = charIDToTypeID( "Lyr " );

var idOrdn = charIDToTypeID( "Ordn" );

var idTrgt = charIDToTypeID( "Trgt" );

ref40.putEnumerated( idLyr, idOrdn, idTrgt );

desc50.putReference( idnull, ref40 );

var idT = charIDToTypeID( "T   " );

var ref41 = new ActionReference();

var idDcmn = charIDToTypeID( "Dcmn" );

ref41.putName( idDcmn, jpg ); // jpg = target document

desc50.putReference( idT, ref41 );

var idVrsn = charIDToTypeID( "Vrsn" );

desc50.putInteger( idVrsn, 5 );

executeAction( idDplc, desc50, DialogModes.NO );

 

// close the original TIF/PSD/JPG file

docTIF.close(SaveOptions.DONOTSAVECHANGES);

 

// delete the layer from the JPG file that has been in Asia

 

var ebenen = docRef.artLayers.length-1;

docRef.artLayers[ebenen].remove();

 

// set the bottom layer as background if it was before

 

if (hgset) {

           var ebenen = docRef.artLayers.length-1;

           docJPG.artLayers[ebenen].isBackgroundLayer = true;

}

 

// and finally overwrite TIF/PSD/JPG in the TIF/PSD/JPG subdirectory

 

switch( dateityp ) {

case("TIF"): docRef.saveAs(new File(newpath),TiffSaveOptions); break;

case("PSD"): docRef.saveAs(new File(newpath),PhotoshopSaveOptions); break;

case("JPG"): docRef.saveAs(new File(newpath),JPEGSaveOptions); break;

}

docRef.close();

 

}

}

}

Why do buttons in two panels have different corners

$
0
0

The following working code creates two 'identical' buttons in two separate panels in a single dialog box.

 

The buttons in the upper panel are shown with rounded corners, those in the lower panel are shown with square corners.

 

Can anyone please explain why; and also how the same (rounded or square) corners may be achieved for buttons in both panels.

 

    var box = new Window( 'dialog', "Test corners of buttons" );

 

    box.panel1 = box.add( 'panel', undefined, "" );

   

    box.panel1_cancelBtn = box.panel1.add( 'button', undefined, "Cancel" );

    box.panel1_createBtn = box.panel1.add( 'button', undefined, "Create" );

 

    box.panel2 = box.add( 'panel', undefined, "" );

   

    box.panel2_cancelBtn = box.panel2.add( 'button', undefined, "Cancel" );

    box.panel2_saveBtn = box.panel2.add( 'button', undefined, "Save" );

   

    box.panel1_cancelBtn.onClick = function() { box.close() };

    box.panel2_cancelBtn.onClick = function() { box.close() };

 

    box.show();

 

For information only, the code has been greatly simplified from a lengthy and complex function [that otherwise works to my satisfaction] that creates a dialog box with some initially inactive panels that are individually activated by clicking an 'OK' button in an active panel.  The other code in the function is not relevant, that shown above demonstrates the issue.

 

The behaviour is observed in ESTK / PS CC 2018 (19.0) under both Windows10 and High Sierra.

 

It's not a big issue, but the lack of visual consistency irritates me, as does my lack of understanding as to why there is a difference.

converting actions into script

$
0
0

Hello Guys,

 

Might be a quick answer for you or maybe not.

I have never scripted anything in my life (except a few macro files in excel) and I am green to this.

 

Simple question - I have a few "actions" in photoshop and I would like them to be converted into scripts as it might come handy for the future as I will be working with some scripters.

So how do I transform this ATN file into a script?

 

The reason behind it is that I am already having one action that has 2 scripts in it and in the future I want to add more, so I will need someone scripting to work on the script itself not actions.

 

Maybe it is also counter-productive so give me your opinion,

 

thanks.

 

Olaf

Convert Live Shape to regular path via Javascript

$
0
0

I have a script which needs to merge paths made up of multiple subpaths into a single path, and sometimes I get the dialog 'This operation will turn a live shape into a regular path'.

 

Is there a command to convert the paths/subpaths which are live shapes into a regular path (and also to determine which are live shape paths that need to be converted) via Javascript?

Viewing all 12244 articles
Browse latest View live


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