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

Export Layers To Files - Renaming Script PS CC

$
0
0

On all previous versions of Photoshop, including CS6 (before the recent update to PS CC), I was able to use the ExtendScript Toolkit to edit the PS preset script that adds naming/numbering sequences to files when running the "Export Layers to Files" script. For PS CS 6, I edited the script to remove the automatic naming/numbering of exported layers by editing the following in ExtendScript Toolkit:

 

In ExtendScript Toolkit CS6 open the Export Layers to Files.jsx (applications/adobe photoshop cs6/presets/scripts/export layers to files.jsx)

on line 1030:

change:

fileNameBody += "_" + zeroSuppress(i, 4);

to:

//fileNameBody += "_" + zeroSuppress(i, 4);

 

on line 1031:

change:

fileNameBody += "_" + layerName;

to:

fileNameBody += "" + layerName;

 

 

This solved my problem and allowed PS to export my layers to files, keeping the layer name as the filename without adding any naming or numbering sequences to the filename. However with the recent release of Photoshop CC, the script change above does not work. It looks as though there are some new lines of scripting with Photoshop CC and I would love to know what else I need to change to prevent PS CC from renaming files when using the Export Layers to File script. Without the ability to change this, I will have to go through numerous steps in bath rename in Bridge, which when working with 100's of files with different naming structures would totally slow down my workflow. Any ideas on what to update in the Photoshop CC Script to fix this? Thanks so very much!


New to scripting. Need help with a >3000px-resize-but-

$
0
0

Hey, all. I'm new to this scripting thing. In fact, I didn't even know it existed until a few minutes ago when I started searching the googles for an answer to my resizing issues.

 

I have some expierence writing expressions in AE, but very basic...

 

I'd like to incorporate some sort of script into an action to resize any images over 3000px on a side to max 3000px, but leave any smaller images alone. I've found lots of examples of resizing scripts but don't understand enough about the language to rewrite them for my purposes.

 

Thanks for the patience and any help you can offer!

Product activation

$
0
0

I have a legit bought copy of photoshop CS; but since the activation centre is no longer available, I can't activate my product. what now?

Ican't download because I don't have access to internet except for @ work. please help?

Need help with querying brush presets info

$
0
0

Hi,

 

I'd like to get the information of brushes from Brush Presets. This information includes names, brush size, hardness, spacing, flip, etc...

 

I've search through the discussion and I'm aware that the best way is to parse/read the abr files manually. Unfortunately, I can't find the file specifiations. The example from Gimp was for an older version of Photoshop ABR I guess. Anyone has any working code/specs that could be shared?

 

If the above is not visible, I'm wondering if there is an alternative way that I could get the brushes information without activating them and getting it from currentToolOptions via the script?

 

So far, I only found how to get the names in the Brush Presets via presetManager and only names are available for querying. Am I missing something? And is it do-able?

 

Your help is very much appreciated.

Layer Saver Script with save to file size export

$
0
0

I would love the makers of Layer Saver Script to be able to produce and Batch Save to web style to an exact file size as the only output.

 

I have tried various combinations to batch save layers but my sile sizes range from 1.5m to 300k depending on the qulaity used.

 

It would really cool if there was a way of batch saving by file size of say 500k instead so the quality bit was automatic.

 

At the moment I am resizing everything manually.

 

Regs,

David

Batch HDR creation script

$
0
0

I have created a Photoshop Script (using JavaScript) for batch creation of HDR images.

I have used theseprevious discussions during implementation.

 

In the beginning part of the script there are some options that you can change to customize the script's operation.

You are free to modify this script and publish your modifications.

 

The script can be found at the following URL (which is a git repository in itself) , and is also pasted below.

https://gist.github.com/1640233

 

 

// Batch Creation of HDR files
// -----------------------------------------------------------------------------------
// Opens a dialog box, asking for the container folder.
// The container folder must have separate sub folders for each of the HDR image series
// The output can be saved in a subfolder with an arbitrary name by
// changing the options below.
//
// example: to save hdr files as 
// C:\container\hdrseries1\myhdrfolder\myhdr.psd
// change the options HDROutputFolder to "myhdrfolder" 
// and option HDRFileName to "myhdr"
// 

// Extensions of source image files
var pictureExtensions = "*.jpg";
// Sub-folder to save the resulting HDR file. This folder will be created if it does not exist.
//var HDROutputFolder = "";  // disable subfolder like this
var HDROutputFolder = "HDR"
// Filename for saved HDR file. Do not set the extension here, extension is set automatically according to saveResultAsEXR option.
var HDRFileName = "HDR";
// Save EXR file (requires EXR plugin) If set to "false" saves the HDR as a  .PSD file
var saveResultAsEXR = false;
// Overwrite existing HDR output files? If set to "false" skips creating HDR files for already created image sets.
// This is useful for adding some new HDR sets into the container folder, and running the script again 
// to crate HDR files only for the newly added series.
var overwriteExistingHDR = false;
// --------------- End of settings ------------------- //

var runMergeToHDRFromScript = true;// define and set to true before including Merge To HDR.jsx
var g_ScriptFolderPath = app.path + "/"+ localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts");
var g_ScriptPath = File( g_ScriptFolderPath+'/Merge To HDR.jsx' );
$.evalFile( g_ScriptPath );

// function to manually save an EXR file. Requires EXR plugn to be installed
function saveEXR(saveFile){
    var idsave = charIDToTypeID( "save" );    var desc6 = new ActionDescriptor();    var idAs = charIDToTypeID( "As  " );    desc6.putString( idAs, "OpenEXR" );    var idIn = charIDToTypeID( "In  " );    desc6.putPath( idIn, saveFile );    executeAction( idsave, desc6, DialogModes.NO );
}

function main()
{
    var bracket_folders = [];    var selected_folder = Folder.selectDialog ("Select the container folder. The container folder should have a separate folder inside for each HDR image series.")    if (selected_folder != null)    {                                            // to process multiple container folders, uncomment following line and edit folder paths.        //bracket_folders = [ Folder('/c/images/bracket5'), Folder('/c/images/bracket9')];           bracket_folders = bracket_folders.concat(selected_folder);        for (var f = 0; f < bracket_folders.length; f++)        {            var image_folders = bracket_folders[f].getFiles();            for (var g = 0; g < image_folders.length; g++)            {                var folder = image_folders[g];                var filelist = image_folders[g].getFiles(pictureExtensions);                var photoshopHDRFolder = Folder(folder.absoluteURI + "/" + HDROutputFolder);                if (saveResultAsEXR) {                    var extension = ".exr";                } else {                    var extension = ".psd";                }                var photoshopHDRFile = File(photoshopHDRFolder.absoluteURI + "/" + HDRFileName + extension);                if (overwriteExistingHDR ==false && photoshopHDRFile.exists == true) {                    continue;                }                mergeToHDR.useAlignment = true;                mergeToHDR.outputBitDepth= 32;                mergeToHDR.mergeFilesToHDR( filelist, true, -2 );                if (photoshopHDRFolder.exists == false) {                    photoshopHDRFolder.create();                }                if (saveResultAsEXR) {                    saveEXR(photoshopHDRFile);                } else {                    activeDocument.saveAs(photoshopHDRFile );  // Use for PSD files                }                activeDocument.close(SaveOptions.DONOTSAVECHANGES);            }        }    }
}

main();

Scale Photoshop layer using AppleScript

$
0
0

Obviously, this is a Mac PS issue.

 

I am trying to script scaling a Photoshop layer (a smart object layer) to a specified percentage that I calculate from a layout in InDesign.

However, I am stumped on the syntax I should use to actually get the layer to resize, or perhaps I don't know how to call out the layer properly.

 

Here is my code (it is very simple at this point in time:

 

 

tell application "Adobe InDesign CS6"          set mySelect to selection  --error trap to make sure I have graphic content selected            tell active spread of active window                    set thisBox to item 1 of mySelect                    set HScale to the absolute horizontal scale of thisBox            end tell
end tell
myScaleConversion(HScale)
set PSScaled to result as real

tell application "Adobe Photoshop CS6"
          set thisLayer to current layer of current document          set scaleSet to {horizontal scale:PSScaled, vertical scale:PSScaled, anchor:"top left"}  scale current layer of current document with scaleSet  
end tell


on myScaleConversion(HScale)
          set ScaleRatio to 2.5 as real          set PSScale to (ScaleRatio * HScale)          return PSScale  
end myScaleConversion

 

 

I would appreciate any help with this. I run this script and no error messages occur, but then again, nothing happens to the Photoshop layer I have targeted.

VBscript Photoshop: convert active document to RGB (PsChangeMode?)

$
0
0

Hi there

I'm trying to convert the color mode of my active document to RGB, IF it needs doing. I'm struggling with the line, I'm a novice with VBscript. I'm trying something like

 

docRef.PsChangeMode = 2

 

But the PsChangeMode generates the error Object doesn't support this property or method. Please can anyone give me some pointers?

Thank you

David


Reserved words

$
0
0

I just discovered that "name" is a reserved word. Or at least if you create a variable called name it'll ignore it.

 

alert(name)

 

Adobe Photoshop

 

Is there a list reserved words in photoshop scripting somewhere so I can avoid them?

Cheers

Data Sets in Photoshop CS2

$
0
0
I'm trying to learn about scripting in Photoshop CS2. By starting, I just want to import variable data into Photoshop, following the help instructions, however am having heaps of issues.

I'm using the Image > Variables > Data Sets > Import option.

My data looks like this..

Variable1
Ben
David
James
Mark

but when I try to import the text file, I get this error message...

"Could not parse the file contents as a data set. There were too many variable names in the first line of the text file."

Can anyone please tell me what I'm doing wrong?

Thanks

Adobe Edit in ACR stopped working.

$
0
0

Hi,

 

Can anyone help ? I have been running Russell Brown's excellent 'Adobe Edit in ACR' script for some time now through version 1.1.5 and now 1.1.6 and for some reason it has now stopped working. I have made no changes to anything that I am aware of (running Photoshop CS6 Extended) but now when I attempt to run the script I get the following script error:

 

General Photoshop error occurred. This functionality may not be available in this version of Photoshop.

The object "current document' is not currently available"

 

The script worked 100% before (both 1.1.5 and 1.1.6) - I have uninstalled and re-installed to no avail.

 

When I run Adobe Edit in ACR it creates a Raw Smart Object layer and then the error message pops up - but ACR does not open. And yes - TIFF preferences within ACR have been set as per Russell's instructions.

 

Anyone got any clues - I e-mailed Russell himself but guess he will be too busy to respond.

 

Regards,

 

Richard

ExtendToolscript opens when I call script from photoshop

$
0
0

Hey,

 

 

I asked this question over in general discussions by mistake so I though I would re-ask it here.

 

I have a Javascript that I have written that builds a interface of buttons in organised groups based on the contents of certain folders. Everything works fine but when you call it from photoshop and extendtoolscript isn't running it always opens it up. I have written a lot of scripts with interfaces and I have never had this problem. Its not a huge problem for me as I usually have this program open anyway but I intend to have a team of people using this script so if I could stop it somehow it would be much better.

 

Has anyone experienced this before? Or perhaps knows of functions that cause extendscript to open?

 

I can't see anything unusual in the script...

 

Any help would be appreciated!

 

Thanks,

 

Mark

 

 

 

 

var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;    
var templatepath = "~/Desktop/BANNERS/";  
var bannerfile = ""
var docRef = app.activeDocument;    
var fileArray = new Array();                  var sourceFolder = Folder (templatepath + "MAIN/");                  var extRE = /\.(?:png|gif|jpg|bmp|tif|psd)$/i;                                // get all files in source folder                var docs = sourceFolder.getFiles();                var len = docs.length;                for (var i = 0; i < len; i++) {                                var doc = docs[i];                                  // only match files (not folders)                                if (doc instanceof File) {                                                // store all recognized files into an array                                                var docName = doc.name;                                                if (docName.match(extRE)) {                                                                fileArray.push(doc);                                                }                                }                }                                    var w = new Window ("dialog", "Choose a Banner");            w.preferredSize = [400, 100];            w.orientation = 'row';            w.alignChildren = "left"            w.alignChildren = [ "fill", "fill"];                        w.btnPnl = w.add('panel', undefined, 'MAIN');                        w.btnPnl.btn = w.add ("group");            w.btnPnl.btn.alignChildren = "left"                        var buttonarray = new Array ();            var key = {};                                                for (var i = 0; i < fileArray.length ; i++) {                                var delimeter = '/';                var string = String (fileArray[i]);                var splitted = string.split(delimeter);                var thelength = ((splitted.length) - 1);                var bannername = splitted[thelength];                var delimeter = '.';                var splitted = bannername.split(delimeter);                var bannername = splitted[0];                                                var checkdelim = "%20";                var checkthat =  bannername.indexOf(checkdelim);                if (checkthat == "-1") {}                else{                                    var delimeter = '%20';                var splitted = bannername.split(delimeter);                var counter = 0;                while (counter < splitted.length){                                if (counter == 0){                var bannername = (splitted[counter] + " ");                    }                elseif (counter == ((splitted.length) - 1)){                var bannername = (bannername + splitted[counter]);                }                else{                var bannername = (bannername + splitted[counter] + " ");                }                var counter = (counter + 1);                }                            }            if (fileArray.length > 6){                    var divider = 2                    }                else{                    var divider = 1                    }                                var remainder = (i % divider);                if (remainder == 0){                  w.btnPnl.btn = w.btnPnl.add ("group");                w.btnPnl.btn.alignChildren = "left"                }else{                //x is not a multiple of y                }                                key = (String (fileArray[i]));                w[key] = w.btnPnl.btn.add("button", undefined ,bannername );                 w[key].alignment = 'left';                buttonarray.push(w[key]);                                w.btnPnl.btn.addEventListener('click', button_pressed);                                function button_pressed (e)                {               if (e.target.type == "button")                $.writeln (e.target.text + " from panel " + e.target.parent.text);                w.close()                ////////////////////                var buttonname = e.target.text;                var checkdelim = " ";                var checkthat = buttonname.indexOf(checkdelim);                if (checkthat == "-1") {}                else{                                    var delimeter = ' ';                var splitted = buttonname.split(delimeter);                var counter = 0;                while (counter < splitted.length){                                if (counter == 0){                var buttonname = (splitted[counter] + "%20");                    }                elseif (counter == ((splitted.length) - 1)){                var buttonname = (buttonname + splitted[counter]);                }                else{                var buttonname = (buttonname + splitted[counter] + "%20");                }                var counter = (counter + 1);                }            }                            ///////////////////////                                bannerfile = new File (templatepath + "MAIN/" + buttonname + '.png');                                 }             }         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
var fileArrayneon = new Array();                  var sourceFolder = Folder (templatepath + "NEON/");                  var extRE = /\.(?:png|gif|jpg|bmp|tif|psd)$/i;                                // get all files in source folder                var docs = sourceFolder.getFiles();                var len = docs.length;                for (var i = 0; i < len; i++) {                                var doc = docs[i];                                  // only match files (not folders)                                if (doc instanceof File) {                                                // store all recognized files into an array                                                var docName = doc.name;                                                if (docName.match(extRE)) {                                                                fileArrayneon.push(doc);                                                }                                }                }                                                            w.btnPnl = w.add('panel', undefined, 'NEON');                        w.btnPnl.btn = w.add ("group");                        var buttonarray = new Array ();            var key = {};                                                for (var i = 0; i < fileArrayneon.length ; i++) {                                var delimeter = '/';                var string = String (fileArrayneon[i]);                var splitted = string.split(delimeter);                var thelength = ((splitted.length) - 1);                var bannername = splitted[thelength];                var delimeter = '.';                var splitted = bannername.split(delimeter);                var bannername = splitted[0];                                                var checkdelim = "%20";                var checkthat =  bannername.indexOf(checkdelim);                if (checkthat == "-1") {}                else{                                    var delimeter = '%20';                var splitted = bannername.split(delimeter);                var counter = 0;                while (counter < splitted.length){                                if (counter == 0){                var bannername = (splitted[counter] + " ");                    }                elseif (counter == ((splitted.length) - 1)){                var bannername = (bannername + splitted[counter]);                }                else{                var bannername = (bannername + splitted[counter] + " ");                }                var counter = (counter + 1);                }                            }                        if (fileArrayneon.length > 6){                    var divider = 2                    }                else{                    var divider = 1                    }                                var remainder = (i % divider);                if (remainder == 0){                  w.btnPnl.btn = w.btnPnl.add ("group");                w.btnPnl.btn.alignChildren = "left"                }else{                //x is not a multiple of y                }                                key = (String (fileArrayneon[i]));                w[key] = w.btnPnl.btn.add("button", undefined ,bannername );                 w[key].alignment = 'left';                buttonarray.push(w[key]);                                w.btnPnl.btn.addEventListener('click', button_pressed);                                function button_pressed (e)                {               if (e.target.type == "button")                $.writeln (e.target.text + " from panel " + e.target.parent.text);                w.close()                ////////////////////                var buttonname = e.target.text;                var checkdelim = " ";                var checkthat = buttonname.indexOf(checkdelim);                if (checkthat == "-1") {}                else{                                    var delimeter = ' ';                var splitted = buttonname.split(delimeter);                var counter = 0;                while (counter < splitted.length){                                if (counter == 0){                var buttonname = (splitted[counter] + "%20");                    }                elseif (counter == ((splitted.length) - 1)){                var buttonname = (buttonname + splitted[counter]);                }                else{                var buttonname = (buttonname + splitted[counter] + "%20");                }                var counter = (counter + 1);                }            }                            ///////////////////////                                bannerfile = new File (templatepath + "NEON/" + buttonname + '.png');                                 }             }  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  ///////////////////////////////////////////////////////////
var fileArray180 = new Array();                  var sourceFolder = Folder (templatepath + "180/");                  var extRE = /\.(?:png|gif|jpg|bmp|tif|psd)$/i;                                // get all files in source folder                var docs = sourceFolder.getFiles();                var len = docs.length;                for (var i = 0; i < len; i++) {                                var doc = docs[i];                                  // only match files (not folders)                                if (doc instanceof File) {                                                // store all recognized files into an array                                                var docName = doc.name;                                                if (docName.match(extRE)) {                                                                fileArray180.push(doc);                                                }                                }                }                                                            w.btnPnl = w.add('panel', undefined, '180');                        w.btnPnl.btn = w.add ("group");                        var buttonarray = new Array ();            var key = {};                                                for (var i = 0; i < fileArray180.length ; i++) {                                var delimeter = '/';                var string = String (fileArray180[i]);                var splitted = string.split(delimeter);                var thelength = ((splitted.length) - 1);                var bannername = splitted[thelength];                var delimeter = '.';                var splitted = bannername.split(delimeter);                var bannername = splitted[0];                                                var checkdelim = "%20";                var checkthat =  bannername.indexOf(checkdelim);                if (checkthat == "-1") {}                else{                                    var delimeter = '%20';                var splitted = bannername.split(delimeter);                var counter = 0;                while (counter < splitted.length){                                if (counter == 0){                var bannername = (splitted[counter] + " ");                    }                elseif (counter == ((splitted.length) - 1)){                var bannername = (bannername + splitted[counter]);                }                else{                var bannername = (bannername + splitted[counter] + " ");                }                var counter = (counter + 1);                }                            }                                   if (fileArray180.length > 6){                    var divider = 2                    }                else{                    var divider = 1                    }                                var remainder = (i % divider);                                                if (remainder == 0){                  w.btnPnl.btn = w.btnPnl.add ("group");                w.btnPnl.btn.alignChildren = "left"                }else{                //x is not a multiple of y                }                                key = (String (fileArray180[i]));                w[key] = w.btnPnl.btn.add("button", undefined ,bannername );                 w[key].alignment = 'left';                buttonarray.push(w[key]);                                w.btnPnl.btn.addEventListener('click', button_pressed);                                function button_pressed (e)                {               if (e.target.type == "button")                $.writeln (e.target.text + " from panel " + e.target.parent.text);                w.close()                ////////////////////                var buttonname = e.target.text;                var checkdelim = " ";                var checkthat = buttonname.indexOf(checkdelim);                if (checkthat == "-1") {}                else{                                    var delimeter = ' ';                var splitted = buttonname.split(delimeter);                var counter = 0;                while (counter < splitted.length){                                if (counter == 0){                var buttonname = (splitted[counter] + "%20");                    }                elseif (counter == ((splitted.length) - 1)){                var buttonname = (buttonname + splitted[counter]);                }                else{                var buttonname = (buttonname + splitted[counter] + "%20");                }                var counter = (counter + 1);                }            }                            ///////////////////////                                bannerfile = new File (templatepath + "180/" + buttonname + '.png');                                 }             }        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
var fileArraymisc = new Array();                  var sourceFolder = Folder (templatepath + "MISC/");                  var extRE = /\.(?:png|gif|jpg|bmp|tif|psd)$/i;                                // get all files in source folder                var docs = sourceFolder.getFiles();                var len = docs.length;                for (var i = 0; i < len; i++) {                                var doc = docs[i];                                  // only match files (not folders)                                if (doc instanceof File) {                                                // store all recognized files into an array                                                var docName = doc.name;                                                if (docName.match(extRE)) {                                                                fileArraymisc.push(doc);                                                }                                }                }                                                            w.btnPnl = w.add('panel', undefined, 'MISC');                        w.btnPnl.btn = w.add ("group");                        var buttonarray = new Array ();            var key = {};                                                for (var i = 0; i < fileArraymisc.length ; i++) {                                var delimeter = '/';                var string = String (fileArraymisc[i]);                var splitted = string.split(delimeter);                var thelength = ((splitted.length) - 1);                var bannername = splitted[thelength];                var delimeter = '.';                var splitted = bannername.split(delimeter);                var bannername = splitted[0];                                                var checkdelim = "%20";                var checkthat =  bannername.indexOf(checkdelim);                if (checkthat == "-1") {}                else{                                    var delimeter = '%20';                var splitted = bannername.split(delimeter);                var counter = 0;                while (counter < splitted.length){                                if (counter == 0){                var bannername = (splitted[counter] + " ");                    }                elseif (counter == ((splitted.length) - 1)){                var bannername = (bannername + splitted[counter]);                }                else{                var bannername = (bannername + splitted[counter] + " ");                }                var counter = (counter + 1);                }                            }                if (fileArraymisc.length > 6){                    var divider = 2                    }                else{                    var divider = 1                    }                                var remainder = (i % divider);                if (remainder == 0){                  w.btnPnl.btn = w.btnPnl.add ("group");                w.btnPnl.btn.alignChildren = "left"                }else{                //x is not a multiple of y                }                                key = (String (fileArraymisc[i]));                w[key] = w.btnPnl.btn.add("button", undefined ,bannername );                 w[key].alignment = 'left';                buttonarray.push(w[key]);                                w.btnPnl.btn.addEventListener('click', button_pressed);                                function button_pressed (e)                {               if (e.target.type == "button")                $.writeln (e.target.text + " from panel " + e.target.parent.text);                w.close()                ////////////////////                var buttonname = e.target.text;                var checkdelim = " ";                var checkthat = buttonname.indexOf(checkdelim);                if (checkthat == "-1") {}                else{                                    var delimeter = ' ';                var splitted = buttonname.split(delimeter);                var counter = 0;                while (counter < splitted.length){                                if (counter == 0){                var buttonname = (splitted[counter] + "%20");                    }                elseif (counter == ((splitted.length) - 1)){                var buttonname = (buttonname + splitted[counter]);                }                else{                var buttonname = (buttonname + splitted[counter] + "%20");                }                var counter = (counter + 1);                }            }                            ///////////////////////                                bannerfile = new File (templatepath + "MISC/" + buttonname + '.png');                                 }             }                           
 w.show();          ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (bannerfile == ""){}else{ 
var targetDocumentName =  docRef.name;
var tempfile = app.open (bannerfile);
var sourceDocumentName = app.activeDocument.name;    
var thewidth = tempfile.width;
var theheight  = tempfile.height;    
app.activeDocument = docRef;
docRef.resizeImage (null, theheight, null, ResampleMethod.BICUBIC);  if ((String(thewidth)) == (String(docRef.width))){
var thelayer = docRef.activeLayer;
copyLayers(sourceDocumentName, targetDocumentName );
docRef.activeLayer = thelayer;}else{
alert ("Document width Incorrect")     
docRef.activeLayer.name = "main";
var thelayer = docRef.activeLayer;
docRef.resizeCanvas (thewidth, null, AnchorPosition.BOTTOMCENTER);
copyLayers(sourceDocumentName, targetDocumentName );
docRef.activeLayer = thelayer;}  imageView ("FtOn");}           ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    
 function copyLayers(sourceDocumentName, targetDocumentName) {  var sourceDoc = app.documents[sourceDocumentName];  var targetDoc = app.documents[targetDocumentName];  var sourceLayer, targetLayer, sourceGroup;    if (app.activeDocument != sourceDoc) {    app.activeDocument = sourceDoc;  }  
var thelayer = tempfile.layers[0];
var layersToCopy = thelayer.name;    if ( typeof layersToCopy === 'string' ) {    sourceGroup = tempfile.layers[0];    targetLayer = sourceGroup.duplicate( targetDoc, ElementPlacement.PLACEATBEGINNING )  }  elseif ( Object.prototype.toString.call( layersToCopy ) === '[object Array]' ) {    for (var i = 0; i < layersToCopy.length; i++) {      sourceLayer = sourceDoc.artLayers.getByName( layersToCopy[i] );      targetLayer = sourceLayer.duplicate( targetDoc, ElementPlacement.PLACEATBEGINNING );    }  }
tempfile.close(SaveOptions.DONOTSAVECHANGES);}      
function imageView (view) {    desc= new ActionDescriptor();        ref = new ActionReference();      if (view.length < 5){         var viewID = charIDToTypeID( view );      }else{         var viewID = stringIDToTypeID( view );      }      ref.putEnumerated( charIDToTypeID( "Mn  " ), charIDToTypeID( "MnIt" ), viewID );    desc.putReference( charIDToTypeID( "null" ), ref );   executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );}

Detect if top line of a layer is empty or not?

$
0
0

I'm trying to work out how the top line of an image layer is transparent or not? I need to know if it contains visable pixels so that i instruct the crop correctly.

 

Ideally in applescript as I understand this. otherwise usual script is fine too.

 

Many Thanks

 

Matt

Resize Canvas applescript using the relative tick?

$
0
0

I'm using this

 

tellapplication "Adobe Photoshop CS6"

  resize canvasheight -1 anchor positiontop center

endtell

 

I want to reduce the size of the image by 1 pixels from the top center. But when I do it manually I would use the "relative" check box,

 

How can I do this?

 

please

Color samplers - dark, light & grey point - how to adjust curves

$
0
0

Hi all

 

I've set dark, light & grey point in an image. Wondering how to adjust the curves based on the color samplers. Manually i invoke the curve dialog box and select the dark pen and choose sampler no1, select light pen and choose sampler no2, select grey pen and choose sampler no3. Any idea how this can be done in script?


How to "change" resolution from DPI to l/cm?

$
0
0

Hi Adobe community,

 

right now I am transferring a huge and slow photoshop action to a javascript cause I needed some kind of dynamic variable an action couldn't offer. And on the other hand: a script is sooo much faster than an action. I had some points where the scripting API didn't give me enough possibilities and I had to use those annoying "action descriptors" I got from the ScriptingListener Plugin... so far so good.

 

But now I am at a point where neither the API nor action descriptors seem to help. I am trying to switch the resolution of the image from "dots per image" to "lines per cm" without really resampling it. I just want to transform the "measurement unit", for example from 304.8 DPI to 120 l/cm or from 72 DPI to 28.346 l/cm.

 

Does anyone know a way how to do this? Obviously it is possible through manual usage of the "image size" menu. And yes, I am aware of the fact that this is just cosmetic. But the client that needs this script sort of insists of the "lines per cm" measurement unit.

 

I would really appreciate any help.

 

Greetings,

Daniel

A script for "Save for Web" as .jpg

$
0
0

I found a script that saves the current selected document in Photoshop as .png to the Desktop, and use it all the time.

 

function main() {

          // declare local variables

          var doc = app.activeDocument;

          var docName = app.activeDocument.name.slice(0,-4);

 

 

    var saveFile = new File("~/Desktop/" + docName + ".png");

    pngSaveOptions = new PNGSaveOptions();

    pngSaveOptions.interlaced = false;

    doc.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);

}

 

main();

 

 

Now I'd really like a similar script to do "Save for Web" as .jpg files, without a colour profile, to the Desktop. Preferably a version to save as 100% quality and one to save as 60% quality.

Any help would be greatly appreciated.

Creating adjustment layers without Script Listener code

$
0
0

I'm assuming it's possible to create an adjustment layer without Script Listener code, but I can't figure out how. I can create a normal layer and change it to a text layer and that seems to be about it. I was specifically trying to create a Photo Filter layer. I can do it with Script Listener code, but now I'm just curious.

 

Example:

 

adjLayer=app.activeDocument.artLayers.add().kind=LayerKind.TEXT; <--This works.

 

adjLayer=app.activeDocument.artLayers.add().kind=LayerKind.PHOTOFILTER ;  <--Does not work.

 

It allows changing to/from either a normal or text layer only. There is also a photoFilter() method which allows adjusting the values of a Photo Filter layer but only if one already exists.

 

So it appears that the add() method in the artLayers collection is only good for adding a normal or text layer. Is there any way to add an adjustment layer (other than using Script Listener code)?

 

Am I missing something simple?

How can I edit a droplet for Photoshop 6?

$
0
0

How can I edit a droplet for Photoshop 6? The company hired somebody to set up the droplet years ago, and nobody remembers how it was set up. The computer that was used to save the files has crashed, and I need to change the path the droplet uses for saving the files. I tried to open the droplet with Image Ready, but it said it was not an image ready droplet and could not be opened. The computer running Photoshop is using Windows XP.

Product activation

$
0
0

I have a legit bought copy of photoshop CS; but since the activation centre is no longer available, I can't activate my product. what now?

Ican't download because I don't have access to internet except for @ work. please help?

Viewing all 12244 articles
Browse latest View live


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