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

insert special chars

$
0
0

Hi guys i have an XML with lots of text and some lines have & character but photoshoscript doesnt insert this on a text box, anyone knows how can i do to insert & char ?

thanks


Insert 'illegal' characters into file name for print label?

$
0
0

Hey all (Happy New Year)

 

I actually see some people here who helped me with this originally so many years ago (hi 'x'). Any way, I'm using this .js file to annotate aerial imagery prior to printing, and I know just enough about scripting to make changes to the basic layout as needs arise - until now. A new rather anal retentive mgr doesn't like substitutions I've made for a few 'illegal' characters that windows doesn't allow in file names. For example, the file name used for the annotation is:

 

001    0003    1in = 660ft    CFL 154_074    01-01014   503-013.tif

 

But Mr. mgr doesn't like the in, the ft and the use of the _ instead of a period (.) so what I need is a modification that goes something like (and note I DO NOT CODE, so stop laughing) -

"look for in and replace with ", look for ft and replace with ' and look for _ and replace with , " so the final annotation written to the image is:

 

 

001    0003    1" = 660'    CFL 154.074    01-01014   503-013.tif

 

My current .js is below, I'd really appreciate any assistance. Thanks! TLL

 

------------

 

// CREATE NEW CANVAS W/SPACE ON TOP

 

var deltaW = 0; // add 'N' pixels to the width

var deltaH = 150; // add 'N' pixels to the height

var anchor = AnchorPosition.BOTTOMCENTER; // anchor point for canvas resize

 

// SET FONT TYPE AND SIZE - use GetFontName.js to get exact name

 

var fontName = "ArialMT";

var fontSize = 18;

 

   // Check if a document is open

   if ( documents.length > 0 ) {

   var originalRulerUnits = preferences.rulerUnits;

   preferences.rulerUnits = Units.PIXELS;

 

   try {

     var docRef = activeDocument;

 

     docRef.resizeCanvas(docRef.width + deltaW, docRef.height + deltaH, anchor);

               

   // Create a text layer at the front

               

   var myLayerRef = docRef.artLayers.add();

   myLayerRef.kind = LayerKind.TEXT;

   myLayerRef.name = "Filename";

   var myTextRef = myLayerRef.textItem;

                               

   // ADD FILE EXTENSION, change the n to y below

 

   var ShowExtension = "n";

 

   myTextRef.size = fontSize;

   myTextRef.font = fontName;

               

// SET TEXT COLOR in RGB values

 

var newColor = new SolidColor();

    newColor.rgb.red = 0;

    newColor.rgb.green = 0;

    newColor.rgb.blue = 0;

    myTextRef.color = newColor;

       

// SET POSITION OF TEXT - PIXELS from left first, then from top.

 

myTextRef.position = new Array( 30,110);

    

               

    // Set the Blend Mode of the Text Layer. The name must be in CAPITALS

    // ie change NORMAL to DIFFERENCE.

    myLayerRef.blendMode = BlendMode.NORMAL;

               

    // select opacity in percentage

    myLayerRef.opacity = 100;

 

    // The following code strips the extension and writes tha text layer.

    // fname = file name only

               

    //use extension if set

    if ( ShowExtension == "y" ) {

       fname = docRef.name;

     } else {

       di=(docRef.name).indexOf(".");

       fname = (docRef.name).substr(0, di);

     }

 

     myTextRef.contents = fname;

 

 

     // docRef.flatten("n");

               

   } catch( e ) {

     // An error occurred. Restore ruler units, then propagate the error back

     // to the user

     preferences.rulerUnits = originalRulerUnits;

     throw e;

   }

 

   // Everything went Ok. Restore ruler units

   preferences.rulerUnits = originalRulerUnits;

}  else {

   alert( "You must have a document open to add the filename!" );

}

Is it worth it for me to learn scripting in PS?

$
0
0

I have absolutely NO experience with javascript, and I have failed miserably every time I have attempted to learn. Should I leave Photoshop scripting to the pros?

 

I work in an environment where we are using PS to create super-high-end imagery seen the world over. We are doing things here that make Adobe's engineers' heads explode. We are automating a lot of our process, and actions have gotten us only so far. Scripting is the next logical step, but I'm not sure if it's within my abilities.

rotating brushes using file stream of saved brushes in javascript

$
0
0

Once again I’m fascinated by a query in the MacIntosh-forum which’s solution I suspect is within JavaScript’s reach but out of my depth – namely:

Can one rotate a brush by Keyboard Shortcut, like in- or decreasing its size or softness?

I mostly use the round brushes myself, so it’s not like I even miss the capability …

 

I suspect by saving a Brush Preset, then saving that one alone as an abr-file, deleting the Brush Preset, reading and editing the abr.file, loading it, selecting the single Brush Preset contained and deleting it, too, one might achieve it.

Of course editing the abr-file with a Script seems a bit risky to me.

 

On xbytor’s advice I downloaded HexEditor, but the Brush Tip Shape-Angle-setting mystifies me … »AnglUntF#Ang@« seems to be the one but I fail to understand the angle-value …

 

Furthermore the total number of brushes (for indexing purposes) eludes me.

 

Anyway, the procedure may be too complicated or time-consuming to make any practical sense (apart from inserting numerous steps in the history, which might be a further drawback in real working conditions), but I guess some of You like exploring theoretical applications of Scripting-techniques, so maybe You could give me Your opinions/advice on the whole matter.

PS3 script to batch rename layers

$
0
0
Sometimes, I make copies of layers (for example: copy little diamonds to align into a shape of the letter M). Each time I "alt+drag" the content in that layer (to make a copy of it), PS makes a copy and then appends the name of the layer to something like "diamond copy 3". After making a ton of copies (and because I'm anal about having actual names for each layer), I want each layer to read "diamond". Instead of manually renaming all these layers, is there a way to highlight the affected layers and choose to rename all layers according to what you want?

Scripting and automation advice - Batch processing and final naming

$
0
0

Right now I am using actions to automate the creation of some 3d mockups. The actions work well, but there seem to be some limitations I can't get around and I assume the scripting is what I need to implement next.

 

 

Here is my basic flow:

 

Artwork created > saved to Dropbox folder

 

Another Mac watches that folder > Automator script runs > opens image with PS droplet >

 

Runs one action to open and process two different 3d mockups

 

Saves final mockup images to new folder in Dropbox

 

 

This actually works quite well, but for a couple things:

 

  1. I can only drop one image file at a time. More than that and first runs, rest get ignored.
  2. When saving the final mockup images, the name of the file is always the name of the mockup PSD and overwrites each time.

 

I would like to be able to drop as many source image files into that Dropbox folder and have automation go through each and every file. I would also like each final 3d mockup image to be saved with the original filename of the source file image.

 

Do I need scripting for this?

 

If it matters I am using Photoshop CS5 on Mac OSX 10.9.1. I don't have any javascript experience to speak of, but can generally figure things out with a little hand holding. I can also share my PS Action if that helps.

 

Thank you!

 

Message was edited by: boinzy - Small edit to flow description, step two

Creating a photoshop action to save a batch of images as patterns

$
0
0

I am trying to use Photoshop actions to script about a thousand image files into PAT files. I am running into a problem with actions when it comes to defining a pattern. The program naturally selects the filename as the name of the pattern when doing it manually, but when I do this while recording an action Photoshop logs the filename used in creating the action and then uses that filename for all sripted patterns. Is there a way to alter that setting to select the current file's name instead?

 

http://i.imgur.com/VVfo9.png

How to call Edit->Auto-Blend Layers ?

$
0
0

Any idea how to do this via scripting, or if it's even possible?

 

Much appreciated


rotating brushes using file stream of saved brushes in javascript

$
0
0

Once again I’m fascinated by a query in the MacIntosh-forum which’s solution I suspect is within JavaScript’s reach but out of my depth – namely:

Can one rotate a brush by Keyboard Shortcut, like in- or decreasing its size or softness?

I mostly use the round brushes myself, so it’s not like I even miss the capability …

 

I suspect by saving a Brush Preset, then saving that one alone as an abr-file, deleting the Brush Preset, reading and editing the abr.file, loading it, selecting the single Brush Preset contained and deleting it, too, one might achieve it.

Of course editing the abr-file with a Script seems a bit risky to me.

 

On xbytor’s advice I downloaded HexEditor, but the Brush Tip Shape-Angle-setting mystifies me … »AnglUntF#Ang@« seems to be the one but I fail to understand the angle-value …

 

Furthermore the total number of brushes (for indexing purposes) eludes me.

 

Anyway, the procedure may be too complicated or time-consuming to make any practical sense (apart from inserting numerous steps in the history, which might be a further drawback in real working conditions), but I guess some of You like exploring theoretical applications of Scripting-techniques, so maybe You could give me Your opinions/advice on the whole matter.

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?

rotating brushes using file stream of saved brushes in javascript

$
0
0

Once again I’m fascinated by a query in the MacIntosh-forum which’s solution I suspect is within JavaScript’s reach but out of my depth – namely:

Can one rotate a brush by Keyboard Shortcut, like in- or decreasing its size or softness?

I mostly use the round brushes myself, so it’s not like I even miss the capability …

 

I suspect by saving a Brush Preset, then saving that one alone as an abr-file, deleting the Brush Preset, reading and editing the abr.file, loading it, selecting the single Brush Preset contained and deleting it, too, one might achieve it.

Of course editing the abr-file with a Script seems a bit risky to me.

 

On xbytor’s advice I downloaded HexEditor, but the Brush Tip Shape-Angle-setting mystifies me … »AnglUntF#Ang@« seems to be the one but I fail to understand the angle-value …

 

Furthermore the total number of brushes (for indexing purposes) eludes me.

 

Anyway, the procedure may be too complicated or time-consuming to make any practical sense (apart from inserting numerous steps in the history, which might be a further drawback in real working conditions), but I guess some of You like exploring theoretical applications of Scripting-techniques, so maybe You could give me Your opinions/advice on the whole matter.

Automate merge files into stack

$
0
0

Hi all,

 

I need to find a way to do the following:

 

Merge 4 currently open images into a single stack into separate layers.

Screen all layers

Extract the top three layers into a new file

Flatten both images and save as .tif

 

Any ideas?

 

Even scripting the 1st two steps would be great.I've tried "Merge files into stack", but it won't let me automate the "add open files" part of that.

 

Thanks.

Copy Shape Attributes & Layer Style from one layer & paste to another?

$
0
0

I don't know Photoshop scripting and wanted a script to copy both the Shape Attributes and Layer Style from one layer, and then another script to paste them to a different layer.

 

I used the ScriptingListener plugin to record these and they do work, but with a problem. If the vector shape has layer styles it will work fine, but if the the shape I'm copying doesn't have any layer styles then it shows an error (as it's trying to copy layer styles that aren't there).

 

Is it possible for a script to detect whether layer styles are present, and if not ignore that and just copy/paste the shape attributes? Or could the script 'try' to copy layer styles but 'fail silently' if none are applied to a layer, and then just copy/paste only the shape attributes?

Is it worth it for me to learn scripting in PS?

$
0
0

I have absolutely NO experience with javascript, and I have failed miserably every time I have attempted to learn. Should I leave Photoshop scripting to the pros?

 

I work in an environment where we are using PS to create super-high-end imagery seen the world over. We are doing things here that make Adobe's engineers' heads explode. We are automating a lot of our process, and actions have gotten us only so far. Scripting is the next logical step, but I'm not sure if it's within my abilities.

Insert 'illegal' characters into file name for print label?

$
0
0

Hey all (Happy New Year)

 

I actually see some people here who helped me with this originally so many years ago (hi 'x'). Any way, I'm using this .js file to annotate aerial imagery prior to printing, and I know just enough about scripting to make changes to the basic layout as needs arise - until now. A new rather anal retentive mgr doesn't like substitutions I've made for a few 'illegal' characters that windows doesn't allow in file names. For example, the file name used for the annotation is:

 

001    0003    1in = 660ft    CFL 154_074    01-01014   503-013.tif

 

But Mr. mgr doesn't like the in, the ft and the use of the _ instead of a period (.) so what I need is a modification that goes something like (and note I DO NOT CODE, so stop laughing) -

"look for in and replace with ", look for ft and replace with ' and look for _ and replace with , " so the final annotation written to the image is:

 

 

001    0003    1" = 660'    CFL 154.074    01-01014   503-013.tif

 

My current .js is below, I'd really appreciate any assistance. Thanks! TLL

 

------------

 

// CREATE NEW CANVAS W/SPACE ON TOP

 

var deltaW = 0; // add 'N' pixels to the width

var deltaH = 150; // add 'N' pixels to the height

var anchor = AnchorPosition.BOTTOMCENTER; // anchor point for canvas resize

 

// SET FONT TYPE AND SIZE - use GetFontName.js to get exact name

 

var fontName = "ArialMT";

var fontSize = 18;

 

   // Check if a document is open

   if ( documents.length > 0 ) {

   var originalRulerUnits = preferences.rulerUnits;

   preferences.rulerUnits = Units.PIXELS;

 

   try {

     var docRef = activeDocument;

 

     docRef.resizeCanvas(docRef.width + deltaW, docRef.height + deltaH, anchor);

               

   // Create a text layer at the front

               

   var myLayerRef = docRef.artLayers.add();

   myLayerRef.kind = LayerKind.TEXT;

   myLayerRef.name = "Filename";

   var myTextRef = myLayerRef.textItem;

                               

   // ADD FILE EXTENSION, change the n to y below

 

   var ShowExtension = "n";

 

   myTextRef.size = fontSize;

   myTextRef.font = fontName;

               

// SET TEXT COLOR in RGB values

 

var newColor = new SolidColor();

    newColor.rgb.red = 0;

    newColor.rgb.green = 0;

    newColor.rgb.blue = 0;

    myTextRef.color = newColor;

       

// SET POSITION OF TEXT - PIXELS from left first, then from top.

 

myTextRef.position = new Array( 30,110);

    

               

    // Set the Blend Mode of the Text Layer. The name must be in CAPITALS

    // ie change NORMAL to DIFFERENCE.

    myLayerRef.blendMode = BlendMode.NORMAL;

               

    // select opacity in percentage

    myLayerRef.opacity = 100;

 

    // The following code strips the extension and writes tha text layer.

    // fname = file name only

               

    //use extension if set

    if ( ShowExtension == "y" ) {

       fname = docRef.name;

     } else {

       di=(docRef.name).indexOf(".");

       fname = (docRef.name).substr(0, di);

     }

 

     myTextRef.contents = fname;

 

 

     // docRef.flatten("n");

               

   } catch( e ) {

     // An error occurred. Restore ruler units, then propagate the error back

     // to the user

     preferences.rulerUnits = originalRulerUnits;

     throw e;

   }

 

   // Everything went Ok. Restore ruler units

   preferences.rulerUnits = originalRulerUnits;

}  else {

   alert( "You must have a document open to add the filename!" );

}


rotating brushes using file stream of saved brushes in javascript

$
0
0

Once again I’m fascinated by a query in the MacIntosh-forum which’s solution I suspect is within JavaScript’s reach but out of my depth – namely:

Can one rotate a brush by Keyboard Shortcut, like in- or decreasing its size or softness?

I mostly use the round brushes myself, so it’s not like I even miss the capability …

 

I suspect by saving a Brush Preset, then saving that one alone as an abr-file, deleting the Brush Preset, reading and editing the abr.file, loading it, selecting the single Brush Preset contained and deleting it, too, one might achieve it.

Of course editing the abr-file with a Script seems a bit risky to me.

 

On xbytor’s advice I downloaded HexEditor, but the Brush Tip Shape-Angle-setting mystifies me … »AnglUntF#Ang@« seems to be the one but I fail to understand the angle-value …

 

Furthermore the total number of brushes (for indexing purposes) eludes me.

 

Anyway, the procedure may be too complicated or time-consuming to make any practical sense (apart from inserting numerous steps in the history, which might be a further drawback in real working conditions), but I guess some of You like exploring theoretical applications of Scripting-techniques, so maybe You could give me Your opinions/advice on the whole matter.

PS3 script to batch rename layers

$
0
0
Sometimes, I make copies of layers (for example: copy little diamonds to align into a shape of the letter M). Each time I "alt+drag" the content in that layer (to make a copy of it), PS makes a copy and then appends the name of the layer to something like "diamond copy 3". After making a ton of copies (and because I'm anal about having actual names for each layer), I want each layer to read "diamond". Instead of manually renaming all these layers, is there a way to highlight the affected layers and choose to rename all layers according to what you want?

Since the CC update Document.saveAs() always opens a dialog

$
0
0

Is anyone else seeing this?

Is there a work around?

 

This is a script I have been using for months to open Illustrator files in Phohoshop, resize them, and then save as PNG.   The source images are dynamically generated and it is impractical to sit around waiting to click on the save dialog after every one.   This is a new issue for a script I have been using for a long time.

 

Photoshop 14.2 x64

Extendscript Toolkit CC 4.0.0.1

How to get corner radius of the shape object.

$
0
0

Hi All,

 

I am trying to get the corner radius of the shape object.

 

Is there any way through which I can get the corner radius of all the corner of the shape object?

 

Thanks in advance..

Insert 'illegal' characters into file name for print label?

$
0
0

Hey all (Happy New Year)

 

I actually see some people here who helped me with this originally so many years ago (hi 'x'). Any way, I'm using this .js file to annotate aerial imagery prior to printing, and I know just enough about scripting to make changes to the basic layout as needs arise - until now. A new rather anal retentive mgr doesn't like substitutions I've made for a few 'illegal' characters that windows doesn't allow in file names. For example, the file name used for the annotation is:

 

001    0003    1in = 660ft    CFL 154_074    01-01014   503-013.tif

 

But Mr. mgr doesn't like the in, the ft and the use of the _ instead of a period (.) so what I need is a modification that goes something like (and note I DO NOT CODE, so stop laughing) -

"look for in and replace with ", look for ft and replace with ' and look for _ and replace with , " so the final annotation written to the image is:

 

 

001    0003    1" = 660'    CFL 154.074    01-01014   503-013.tif

 

My current .js is below, I'd really appreciate any assistance. Thanks! TLL

 

------------

 

// CREATE NEW CANVAS W/SPACE ON TOP

 

var deltaW = 0; // add 'N' pixels to the width

var deltaH = 150; // add 'N' pixels to the height

var anchor = AnchorPosition.BOTTOMCENTER; // anchor point for canvas resize

 

// SET FONT TYPE AND SIZE - use GetFontName.js to get exact name

 

var fontName = "ArialMT";

var fontSize = 18;

 

   // Check if a document is open

   if ( documents.length > 0 ) {

   var originalRulerUnits = preferences.rulerUnits;

   preferences.rulerUnits = Units.PIXELS;

 

   try {

     var docRef = activeDocument;

 

     docRef.resizeCanvas(docRef.width + deltaW, docRef.height + deltaH, anchor);

               

   // Create a text layer at the front

               

   var myLayerRef = docRef.artLayers.add();

   myLayerRef.kind = LayerKind.TEXT;

   myLayerRef.name = "Filename";

   var myTextRef = myLayerRef.textItem;

                               

   // ADD FILE EXTENSION, change the n to y below

 

   var ShowExtension = "n";

 

   myTextRef.size = fontSize;

   myTextRef.font = fontName;

               

// SET TEXT COLOR in RGB values

 

var newColor = new SolidColor();

    newColor.rgb.red = 0;

    newColor.rgb.green = 0;

    newColor.rgb.blue = 0;

    myTextRef.color = newColor;

       

// SET POSITION OF TEXT - PIXELS from left first, then from top.

 

myTextRef.position = new Array( 30,110);

    

               

    // Set the Blend Mode of the Text Layer. The name must be in CAPITALS

    // ie change NORMAL to DIFFERENCE.

    myLayerRef.blendMode = BlendMode.NORMAL;

               

    // select opacity in percentage

    myLayerRef.opacity = 100;

 

    // The following code strips the extension and writes tha text layer.

    // fname = file name only

               

    //use extension if set

    if ( ShowExtension == "y" ) {

       fname = docRef.name;

     } else {

       di=(docRef.name).indexOf(".");

       fname = (docRef.name).substr(0, di);

     }

 

     myTextRef.contents = fname;

 

 

     // docRef.flatten("n");

               

   } catch( e ) {

     // An error occurred. Restore ruler units, then propagate the error back

     // to the user

     preferences.rulerUnits = originalRulerUnits;

     throw e;

   }

 

   // Everything went Ok. Restore ruler units

   preferences.rulerUnits = originalRulerUnits;

}  else {

   alert( "You must have a document open to add the filename!" );

}

Viewing all 12244 articles
Browse latest View live


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