RetouchPRO

Go Back   RetouchPRO > Tools > Software > Photoshop Scripting
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read


Photoshop Scripting Learning and sharing for all platforms

Script to find/replace text in layer names?

Reply
 
Thread Tools
  #11  
Old 05-21-2012, 12:45 PM
Limey2632 Limey2632 is offline
Junior Member
 
Join Date: May 2012
Posts: 4
Re: Script to find/replace text in layer names?

Paul, you are a genius! Perfect. Works great and is a very beneficial tool that will be used on a regular basis. For anyone that works with large numbers of files on a daily basis, this is a script well worth installing and truthfully would be something that Adobe should contemplate integrating into Photoshop.

Paul, as always a huge debt of gratitude is owed to you,
Thanks,

Limey (Paul)
Reply With Quote top
  #12  
Old 06-16-2012, 09:17 PM
bdeshazer bdeshazer is offline
Junior Member
 
Join Date: Nov 2003
Location: Kansas, USA
Posts: 21
Re: Script to find/replace text in layer names?

Quote:
Originally Posted by Paul R View Post
Althouth if you are using Photoshop CS6 it will slow it down as it will need to select the layer to modify the name, CS6 is a bad release for scripters, and Bridge is terrible.
Hey Paul, where can I find out more information about these issues? Can you explain a bit more what they changed in CS6?

Thx!
Reply With Quote top
  #13  
Old 06-18-2012, 02:44 PM
Paul R Paul R is offline
Junior Member
 
Join Date: Jan 2010
Posts: 18
Re: Script to find/replace text in layer names?

I don't think there is a list anywhere of all the problems.
As an example run this code in Photoshop and Bridge, you will see that it works in Photoshop (also in ESTK) but does not work as it should in Bridge. This problem will affect most user written scripts that have an UI
Code:
var w = new Window ("dialog");
var s = w.add ("statictext", undefined, "Static");
var e = w.add ("edittext", undefined, "Edit");
var b = w.add ("button", undefined, "Button");
w.graphics.backgroundColor = w.graphics.newBrush (w.graphics.BrushType.SOLID_COLOR, [0.5, 0.0, 0.0]);
s.graphics.font = ScriptUI.newFont ("Georgia", "Bold", 30);
s.graphics.foregroundColor = s.graphics.newPen (w.graphics.PenType.SOLID_COLOR, [0.7, 0.7, 0.7], 1);
e.graphics.font = ScriptUI.newFont ("Letter Gothic Std", "Bold", 30);
e.graphics.foregroundColor = e.graphics.newPen (e.graphics.PenType.SOLID_COLOR, [1, 0, 0], 1);
e.graphics.backgroundColor = e.graphics.newBrush (e.graphics.BrushType.SOLID_COLOR, [0.5, 0.5, 0.5]);
b.graphics.font = ScriptUI.newFont ("Minion Pro", "Italic", 30);
w.show ();
This is where we were at CS2 level!


In Photoshop CS5 I could update layernames without making the layer active but need to make the layer active in CS6.
There are other problems, such as the new Automatic Bicubic can case problems in old scripts, There are some new stringIDs that need to be used with CS6 as older scripts will fail.

It does mean you have to be more careful and do a full test of your code in all the versions of Photoshop that you need to target.
Reply With Quote top
  #14  
Old 09-20-2012, 02:01 PM
Navstar Navstar is offline
Junior Member
 
Join Date: Aug 2008
Posts: 19
Re: Script to find/replace text in layer names?

Quote:
Originally Posted by Paul R View Post
Ok Paul, here is something for you to test, I have also added a checkbox so that you can create a snapshot.
For general information, this script requires Photoshop CS3 or better.
This looks like a great script. But what if I just want to completely rename and sequentially number all my selected layers?

For example, I have a mishmash of exported layers from Illustrator: Layer A 5, Layer 1X copy, <path>, <path> + <path>

I want to name those selected layers to: Bar 01, Bar 02, Bar 03, Bar 04

How would I do it with the current script?
Reply With Quote top
  #15  
Old 09-21-2012, 03:45 PM
Paul R Paul R is offline
Junior Member
 
Join Date: Jan 2010
Posts: 18
Re: Script to find/replace text in layer names?

Ah, you would need a different script to do that.
This should do it....
Attached Files
File Type: zip RenameLayers.zip (1.7 KB, 261 views)
Reply With Quote top
  #16  
Old 10-10-2012, 02:02 PM
Navstar Navstar is offline
Junior Member
 
Join Date: Aug 2008
Posts: 19
Thumbs up Re: Script to find/replace text in layer names?

Perfection! Thank you so much Paul! (This is so helpful, it should be built into Photoshop)
Reply With Quote top
  #17  
Old 10-10-2012, 02:07 PM
Navstar Navstar is offline
Junior Member
 
Join Date: Aug 2008
Posts: 19
Re: Script to find/replace text in layer names?

Quote:
Originally Posted by Paul R View Post
Ah, you would need a different script to do that.
This should do it....
On a semi-related subject, would this script be difficult to convert into something Illustrator could use?

(And I promise to check back on this forum!)
Reply With Quote top
  #18  
Old 10-10-2012, 03:01 PM
Paul R Paul R is offline
Junior Member
 
Join Date: Jan 2010
Posts: 18
Re: Script to find/replace text in layer names?

I wish I could answer but I don't have Illustrator, but what I've heard about Illustrator it does not work the same way so making an educated guess I don't think it could be converted for Illustrator.
Reply With Quote top
  #19  
Old 10-11-2012, 01:08 PM
Navstar Navstar is offline
Junior Member
 
Join Date: Aug 2008
Posts: 19
Re: Script to find/replace text in layer names?

Drat. I figured that would be too easy. Paul, would you mind if I posted your script over at the Adobe Illustrator Scripting board? Maybe some Illustrator guru could come up with a solution...
Reply With Quote top
  #20  
Old 10-12-2012, 03:25 PM
Paul R Paul R is offline
Junior Member
 
Join Date: Jan 2010
Posts: 18
Re: Script to find/replace text in layer names?

There is a lot of Action Manager code in the script that will not be compatible with Illustrator, but by all means, yes you can post it. Mark does a lot of Illustrator scripting so he might be able to tell you what can be done.
Reply With Quote top
Reply

  RetouchPRO > Tools > Software > Photoshop Scripting


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial 05: Converting a Color Image to Black and White grayscale BW DannyRaphael Photo-Art 101 17 05-22-2011 05:55 PM
help with german Photoshop commands please pure Photoshop Help 9 06-21-2010 03:33 PM
Layer Tutorials..again? zip022 RP Tutorials 21 11-18-2004 11:10 PM
select shape Peg Hidden Power Support 7 08-29-2004 07:10 PM
Help needed understanding these layers. peejay Photo-Based Art 3 01-16-2004 09:15 PM


All times are GMT -6. The time now is 03:27 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2016 Doug Nelson. All Rights Reserved