• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

find a word or number and zoom to find in photoshop ?

Contributor ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

Hi,

CS6

I have many layers, some of which are text tool made.

I wish to search for e.g the number 91 and then zoom to it as the file is massive and very tall.

Its a montage of ladder types. each ladder has a Type number such as Type 43 written over it as a text layer and grouped to it.

Searching for such numbers by eye takes forever, as they are placed to suit ladder design and not in numerical order.

So once found how can I zoom to the find ?

 

Cheers

 

Merlin3

TOPICS
Windows

Views

331

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
LEGEND ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

This would require a custom script to search text layers.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

Photoshop CS6 has Layer Search:

https://www.youtube.com/watch?v=Zi327Jyb4Ws

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

I don't think textitem contents can be searched with this? Its mostly layer attributes such as blend modes and visibility.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

This is a basic Photoshop script to find text in layers. If the search term if found, the layer is selected and the script stops.

You'll have to figure out zooming in on the text and add it from here.

 

/*
Utility Pack Scripts created by David M. Converse ©2018-24

This script finds text in open Photoshop documents

Last modifed 4/3/2024

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#target photoshop

findText();

function findText(){
    if(documents.length > 0){
        var searchTerm = '';
        var found = false;
        var docRef = activeDocument;
        try{
            searchTerm = Window.prompt('Enter the text to search for');
            if(searchTerm == null){
                return;
                }
            else{
                searchTerm = searchTerm.toLowerCase();
                for(var i = 0; i < docRef.artLayers.length; i++){
                    var LayerRef = docRef.artLayers[i];
                    if(LayerRef.kind == LayerKind.TEXT){
                        var TextRef = LayerRef.textItem;
                        var layerText = TextRef.contents;
                        layerText = layerText.toLowerCase();
                        if(layerText.search(searchTerm) != -1){
                            found = true;
                            docRef.activeLayer = LayerRef;
                            return;
                            }
                        }
                    }
                if(found == false){
                    Window.alert(searchTerm + ' not found');
                    return;
                    }
                }
            }
        catch(e){
            Window.alert(e + e.line);
            }
        }
    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

Hi, Thanks for the script, I googled how to use a script, saved it as a .jsx, file> scripts browse to script ran it, entered 39 to search for, and waited, GPU fan increased, waited 2 mins. nothing happened, photoshop had frozen, so end task.

relaunch Pshop.

try for a word, same problem, third time try *handrail* get syntax error,

so unable to get it to work.

 

DBenz

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

I do not have CS6 to test with so I can't promise that the script works. But the basics should be the same, that's an example of what you'd need to write.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

CS6 is so old that I can't remember if it has a menu item under View > Fit Layer(s) on Screen ?

 

Does the layer name match the text content?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Hi,

yes, when I type out the label for the photo that text is then also the label name.

Cheers

DBenz

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Please provide a sample file. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

I am not sure a Photoshop version like CS6 will run the Script, but in principle one can determine the position of an image in the window (thanks to @r-bin ); with the Script below the selected Layer should be centered. (see screenshots)

Screenshot 2024-04-04 at 14.41.07.png

// move the center of the window to selected layer;
// 2024, use it at your own risk;
if (app.documents.length > 0) {
var layerBounds = activeDocument.activeLayer.bounds;
// pixels;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// get window values;
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("viewInfo"));    
r.putEnumerated(charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));    
var bounds = executeActionGet(r).getObjectValue(stringIDToTypeID("viewInfo")).getObjectValue(stringIDToTypeID("activeView")).getObjectValue(stringIDToTypeID("globalBounds"));
var theLeft = bounds.getUnitDoubleValue(stringIDToTypeID("left"));
var theTop = bounds.getUnitDoubleValue(stringIDToTypeID("top"));
var theRight = bounds.getUnitDoubleValue(stringIDToTypeID("right"));
var theBottom = bounds.getUnitDoubleValue(stringIDToTypeID("bottom"));
var windowW = theRight - theLeft -16;
var windowH = theBottom - theTop - 16;
// get zoom;
var theZoom = getActiveDocumentZoom();
// set position:
set_doc_position((Number(layerBounds[0])+(Number(layerBounds[2])-Number(layerBounds[0]))/2)*(-1)*theZoom/100+windowW/2, (Number(layerBounds[1])+(Number(layerBounds[3])-Number(layerBounds[1]))/2)*(-1)*theZoom/100+windowH/2);
//set_doc_position(theX*(-1)*theZoom/100+windowW/2, theY*(-1)*theZoom/100+windowH/2);
app.preferences.rulerUnits = originalRulerUnits;
//}
};
////////////////////////////////////
//  by r-bin;
function set_doc_position(x, y)  
{  
try {  
    var r = new ActionReference();    
    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("viewInfo"));    
    r.putEnumerated(stringIDToTypeID("document"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));    
    var bounds = executeActionGet(r).getObjectValue(stringIDToTypeID("viewInfo")).getObjectValue(stringIDToTypeID("activeView")).getObjectValue(stringIDToTypeID("globalBounds"));          
    var b = new Array();
    b[0] = bounds.getUnitDoubleValue(stringIDToTypeID("left"));          
    b[1] = bounds.getUnitDoubleValue(stringIDToTypeID("top"));  
    b[2] = bounds.getUnitDoubleValue(stringIDToTypeID("right"));  
    b[3] = bounds.getUnitDoubleValue(stringIDToTypeID("bottom"));  

    var dx = 8; // what is it?  
    var dy = 8; // what is it?  

    x = (b[2]-b[0])/2 - x - dx;  
    y = (b[3]-b[1])/2 - y - dy;  

    var d = new ActionDescriptor();    
    var r = new ActionReference();    
    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("center"));    
    r.putEnumerated(stringIDToTypeID("document"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));    
    d.putReference(stringIDToTypeID("null"), r);    

    var d1 = new ActionDescriptor();    

    d1.putUnitDouble(stringIDToTypeID("horizontal"), stringIDToTypeID("distanceUnit"), x);  
    d1.putUnitDouble(stringIDToTypeID("vertical"),   stringIDToTypeID("distanceUnit"), y);  

    d.putObject(stringIDToTypeID("to"), stringIDToTypeID("center"), d1);    
    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);    
    }  
catch (e) { throw(e); }  
};
// by mike hale;
function getActiveDocumentZoom(){
   var ref;
   ref = new ActionReference();
   ref.putProperty( charIDToTypeID( "Prpr" ),charIDToTypeID('Zm  '));
   ref.putEnumerated(charIDToTypeID('Dcmn'), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
   return (executeActionGet(ref).getUnitDoubleValue (charIDToTypeID('Zm  ')))*100;
};

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Come to think of it: How should multiple finds be handled (if the number appears more than once in an image)? 

 

Edit: Another Script to find text in Type Layers; it just selects all the Type Layers that contain the String. 

// select type layers containing certain text;
// 2022, use it at your own risk;
if (app.documents.length > 0) {
selectTypeLayerWithText("tempor")
};
////////////////////////////////////
function selectTypeLayerWithText (theString) {
var theCheck = false;
// get number of layers;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var applicationDesc = executeActionGet(ref);
var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
// process the layers;
var theLayers = new Array;
for (var m = 0; m <= theNumber; m++) {
try {
var ref = new ActionReference();
ref.putIndex( charIDToTypeID( "Lyr " ), m);
var layerDesc = executeActionGet(ref);
var layerSet = typeIDToStringID(layerDesc.getEnumerationValue(stringIDToTypeID("layerSection")));
var isBackground = layerDesc.getBoolean(stringIDToTypeID("background"));
// if not layer group collect values;
if (layerSet != "layerSectionEnd" && layerSet != "layerSectionStart" && isBackground != true && layerDesc.hasKey(stringIDToTypeID("textKey")) == true) {
var theName = layerDesc.getString(stringIDToTypeID('name'));
var theID = layerDesc.getInteger(stringIDToTypeID('layerID'));
var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));
var theText = textDesc.getString(stringIDToTypeID('textKey'));
// compare text;
if (theText.match(theString) != null) {
    selectLayerByID(theID,theCheck);
    theCheck = true;
    theLayers.push([theName, theID, theText])
};
};
}
catch (e) {};
};
if (theLayers.length == 0) {
    alert ("no matching layer"); 
    return
} else {return theLayers}
};
// based on code by mike hale, via paul riggott;
function selectLayerByID(id,add){ 
add = undefined ? add = false:add 
var ref = new ActionReference();
    ref.putIdentifier(charIDToTypeID("Lyr "), id);
    var desc = new ActionDescriptor();
    desc.putReference(charIDToTypeID("null"), ref );
       if(add) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) ); 
      desc.putBoolean( charIDToTypeID( "MkVs" ), false ); 
   try{
    executeAction(charIDToTypeID("slct"), desc, DialogModes.NO );
}catch(e){
alert(e.message); 
}
};

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

The script I posted stops after the first found layer but it could easily continue. At this point I think we don't have enough info or ability to test (I don't have CS6.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Hi,

run that script, error 8800 , version of photoshop etc , may not work etc.

 

and I have only one of each Type Number, I just abutt images with same Type number of object before labelling.

 

Cheers

Merlin3

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

As @Lumigraphics mentioned more information is needed. 

I also don’t have access to Photoshop CS6 at my work.

And I suspect the same may apply to many of the other regulars, so it may be impossible to get a solution for your exact problem. 

 

Again: Please provide a sample file. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Did you try the built-in Layer Search as explained in this viseo?

https://www.youtube.com/watch?v=Zi327Jyb4Ws

 

Do you find yourself turning off and on 100s of layers to find the particular one? Or maybe, it's a mess with lots of unnecessary layers! That's when the Layer Search feature in Photoshop saves you. You can find, organize, sort, and even view only the layers you need. It gives you an arsenal of ...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Does Layer Search include finding text contents? I'd love to use it if it did, but I haven't found that feature.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Screenshot 2024-04-04 at 18.01.01.pngScreenshot 2024-04-04 at 18.01.04.png

Edit: The OP claimed that the text and the name of the Layer would be identical so the name-search should suffice. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Ok, the OP's postings are a bit confusing, and of course we don't have a sample file to look at.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

I think the search-field in the Layers Panel was introduced post-CS6 anyway. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

If layer names do not match the text contents, this script will batch update them. Then Layer Search would work.

 

/*
Utility Pack Scripts created by David M. Converse ©2018-24

This script renames text layers in an open Photoshop document

Last modifed 4/4/2024

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#target photoshop

renameTextLayers();

function renameTextLayers(){
    if(!app.documents.length > 0){
        return;
        }
    var docRef = activeDocument;
    try{
        for(var i = 0; i < docRef.artLayers.length; i++){
            var LayerRef = docRef.artLayers[i];
            if(LayerRef.kind == LayerKind.TEXT){
                var TextRef = LayerRef.textItem;
                var layerText = TextRef.contents;
                LayerRef.name = layerText;
                }
            }
        }
    catch(e){
        Window.alert(e + e.line);
        }
    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Does Photoshop CS6 feature View > Fit Layer(s) on Screen? 

Screenshot 2024-04-04 at 17.09.27.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

Hi,

alas...no,

I will try and do a test file, the real one is 3.1Gb

Merlin3

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 05, 2024 Apr 05, 2024

Copy link to clipboard

Copied

LATEST

That's a really large file, what computer do you have? I'm guessing an older one since you are on CS6?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines