🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.photoshop.scripting
Article #1928

Replace text in text layer

#1928
From: johnnyhall81
Date: Thu, 08 Jul 2004 12:52
23 lines
1440 bytes
Hi guys, I am writing a script that selects a text layer and replaces the current text with new text.

The code below replaces the text in the layer named 'myTextLayer' with the text "Changed".

thisDoc.artLayers["myTextLayer"].textItem.contents = "Changed";

This is fine if you know the name of the layer containing the text. But I have to replace the text layer in a large number of files which have different names for their text layer.

However I do know that there will only be 1 text layer per file - so I need to find a way to highlight that text layer and then change the text.

Does anyone know of such a statement? Something along the lines of...

for (layer = 0; layer < layer.length; layer++)
{
if (layer == TEXT)
{
    replace text;
    }
    else
{
do nothing
}
}
Technical Details
Message-ID: <3bb4f495.-1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!webx

Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,ecbcd85c454b2094,start
X-Google-Attributes: gidf5839,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: johnnyhall81@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.photoshop.scripting
Subject: Replace text in text layer
Message-ID: <3bb4f495.-1@webx.la2eafNXanI>
Date: Thu, 8 Jul 2004 05:52:58 -0700
Lines: 40
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit