Replace the contents of the layer text by current image name

Hi all new (I ve posted another topic about 1 hour ago )

I have another question:

Imagine opening an image called Gustavo.jpg (my name)

Now, you manually create a layer of text placed at the right place and you type 'your name here '.

This layer is selected in the layers panel.

Now the question:

Is there a simple way to make a script that replaces the selected type layer that s written 'your name here' by the name of the current image (Gustavo)?

Thank you very much for the help.

Gustavo.

This will remove the extension...

function main() {
if (!app.documents.length ) return;
var doc = app.activeDocument;
var fnameLayer = doc.layers.getByName("Filename Layer");
fnameLayer.textItem.contents = doc.name.replace(/\.[^\.]+$/, '');
};
main();

Tags: Photoshop

Similar Questions

  • Replace the layer of the history feature.

    Here is a little thing that I've been missing - the ability to replace a layer, with the stage of history active easily.

    As an example lets say you have an adjustment layer, which have recently changed you. Compared with the initial snapshot, the one created when you open the file, and you say: "hit on what I this session looks like complete garbage, I want to quickly replace a layer of the snapshot. A control-click and choose "Replace the layer of history" would be a quick way to do it. Of course, this will work with any layer.

    Of course, I am aware that it is a workaround where you can create a new document from any snapshot, then drag it to replace and delete the old layer - but this method click would be highly appreciated.

    Thank you, enjoying your love and support.

    xxx

    Hmm, an interesting idea.

    There will be some limitations: the depth, color and layer organization mode (at least close to the target layer) must match between States in history.   And I think he needs a little more the UI to make it understandable.

    That we will add to the wish list.

  • The object 'before the layer' is not currently available

    Hi all

    I have a pretty complex thing that involves the mounting of batteries of 5 layers. Instead click on the individual image, since it records the name of file, I tried to use the shortcut keys Alt + [], or Alt +. /, as select the layer backward, front layer, layer of upper layer, respectively.

    It works well for the first action, but then after I tried the next day I get an error message saying 'the object 'before the layer' is not currently available.

    How can I avoid this action so I can continue to automate the batteries of my image?

    Thanks to anyone in advance.

    Alex

    Most likely, you will need to establish a starting point by clicking on a layer named common, as a background.

  • After Effects customize template with web browser? (name of the layer by giving a variable name)?

    After Effects customize template with web browser? (name of the layer by giving a variable name)?

    so many web sites provideing this service... .online at the intro

    Please help me what plugins using. How to set up this kind of service?

    I think that we should move to an AE forum...

  • After you create an action to reduce the size and convert them to JPEG format, how to eliminate the word "copy" of each image name?

    After you create an action to reduce the size and convert them to JPEG format, how to eliminate the word "copy" of each image name?

    You can batch process using the image processor script and no user action should still be included in the process.  Check out our menu file > Scripts > image processor.

  • Replace the selected text with other content TextFrame

    Hello

    I am changing a text selected in something new, involving the movement of text and the paragraph style using a jsx script. At the present time, everything works beautifully:

    • I entered the select text
    • I have create a new temporary TextFrame
    • I build my new paragraphs and apply styles to them in the new TextFrame

    What I was not able to reach still is to replace the original selected text by temporary TextFrame content.

    Any help would be more than welcome

    A part of my script:

    myText = app.selection[0].contents;

     

    ... do some stuff


    var myDocument = app.documents.item(0);

    var myPage = myDocument.pages.item(0);

    var myTextFrame = myPage.textFrames.add();


    myTextFrame.geometricBounds = [0, -70, 150, 70];

    myTextFrame.contents = "Paragraph1\rParagraph2...";


    myTextFrame.paragraphs[0].appliedParagraphStyle = pStyleGroup.paragraphStyles.itemByName('Style1');

    myTextFrame.paragraphs[1].appliedParagraphStyle = pStyleGroup.paragraphStyles.itemByName('Style2');

    And now, in myTextFrame, I have my new paragraph formatted, and I would like to replace the original selected text with the contents of my TextFrame (keeping the paragraph styles).

    Hello

    Keep the logic of the code and edit utilities:

    var
        mSourceIdx = app.selection[0].index,
        mStory = app.selection[0].parentStory,
        mReplaceStuff = {
            elements: [
                ["Paragraph_1\r",  "Style_1"],
                ["Paragraph_2\r",  "Style_2"],
                ["Paragraph_X\r",  "Style_X"]
                ]},
        mTarget, cElement, cText, cParaStyle;
    
    while (cElement = mReplaceStuff.elements.pop()) {
        cText = cElement[0];
        cParaStyle = app.activeDocument.paragraphStyles.item(cElement[1]);    // modify if styleGroups present in a structure
      mTarget = mStory.insertionPoints.item(mSourceIdx);
        mTarget.contents = cText;
        mTarget.paragraphs[0].appliedParagraphStyle = cParaStyle;
         }
    
    app.selection[0].contents = "";
    

    MReplaceStuff allows to prepare stuff to replace

    Jarek

  • Replace the JQuery text is all the text in the webapp manufacture

    Hello, I hope someone could give me a hand!

    On this home page: www.largemouthfrog.net I am running a Web application called "Testimonials" which produces a string of words/phrases on the basis of the selected check box. "They come in the page as: < li >... <div class= 'testimony-commentaires1' >awesome! Excellent! really good < /div >... < /li >

    For each < li > there is a separate set of words or phrases separated by a comma.

    I want to remove the comma and replace < br >

    I have the following JQuery (see below) which replaces the comma with < br > BUT it must be the first instance of < li > of

    "<div class= 'testimony-commentaires1" > and it repeats again and again for all other < li > ' s. " In other words:
    "great!, great!, really good" is repeated several times.

    I tried to put the JQuery inside available to the Web application list, but does the same thing.

    < script >

    {$(document) .ready (function ()}

    var str = $(".testimonial-comments1").html () replace (/, / g, '< br / >');

    $(".testimonial-comments1").html (str);

    });;

    < /script >

    Any help would be appreciated!

    Hi Wayne,

    Your code is a bit too simplistic and it fails because it is not really

    loop through all elements of web application and instead, it captures the content of the

    first one defines the rest of them with this content. I have created some

    code that will help you get started. Here it is:

    $(".testimonial-comments1").each (function (index) {var tags_text =

    $(this) .text (); var split_text = tags_text.split(',');

    Console.log (split_text); });

    You can see here http://mgtrain.worldsecuresystems.com/tags

    My class is simply called "label" and my layout of the list looks like this:

    {tag_name}

    {tag_tags}

    Basically, this code creates an array of strings for each iteration.
    All you have to do now is to browse table and Add.
    "to each.

    point, join the elements in a string, then set $(this) .text () of this new

    value.

    That said, I recommend you to build a form UL these options in this

    case. It's a bit more semantic to me.

    I can actually make this my first blog at www.twoblokeswithapostie.com

    See you soon,.

    Mario

  • Replace the layer source footage with After Effects Composition

    Hello!

    I have a question about the workflow of dynamic linking between Premiere Pro and After Effects. As common for most editing workflows, I started by import and organize my source footage. I then cut the entire project using the original footage. Now, as he comes to effects and final optimizations, I noticed that there are several items that I need to work in After Effects.

    I know (and use) the function 'Replace with After Effects Composition', but this only works for an item in the Assembly. I have dozens of clips from same source footage and would simply replace the master-clip with a composition. In this way, I can do the AE-job once that overall the clip and the whole project remains perfectly organized.

    As I read elsewhere, there is no characteristic that makes this replacement directly. Trying to "Replace Footage" with one generates an AE-project error. After Effects render and replace the images with the rendered results (as advised in a similar topic) is no option, given that I'd lose dynamic links in this way. My question is: Y at - it another way or the workaround to replace my source footage of the layer with an After Effects composition?

    Thanks in advance for the help and advice!
    Best regards

    What you can get in the way you want.  Your best option is to export a new clip of the AE and use it to a replace operation in the tray.

    In the future, as a Pseudo-solution you can put the 'AE' in their own, dedicated footage clips and change using these sequences, as if they were real clips.  This would allow you to keep the dynamic link in place.

  • A Script to find and replace the layer names

    Is there scripts to find and replace the names of layers?

    There is an excellent script available for Photoshop that allows you not only to replace words in layer names, but also insert words as prefixes, Suffixes and sequential numbers.

    The version of the illustrator of this script allows only sequential numbering: it does not offer search and replace words.

    Ideally, it would be great if there were something that could find multiple and replaces in a go:

    (for example

    You have layers like this car, the dog, the bat

    You enter: because (Option1), dog (Option2), Bat (Option3)

    Your layers become then: option 1, option 2, Option3).

    )

    Big_SmiLe, which is a very good start! Step 1 of learning how to Script is indeed, by adjusting an existing simple script to make things more complicated. (And usually then "break something", which is also a necessary part of the process.)

    You are right your comment, it comes to repetitive things. For one or two different articles that wouldn't be a problem, but in the longer lists you are soon lost.

    As usual to work with lists of search - replace is to build a table:

    var layernames = [
    [ 'FHairBowlBoy *Hair', 'Hairboy1' ],
    [ 'FHairCurlyafroBoy *Hair', 'Hairboy2' ],
    [ 'FHairSpikyBoy *Hair', 'Hairboy3' ],
    ];
    

    The general idea is to loop through all the names, check if the current layer name is "layernames [i] [0]" (the left column) and if so, rename it "layernames [i] [1]" (the right column). If you know how to write a loop in Javascript, then you can implement this immediately.

    However...

    A more advanced method to do this didn't need even loop on all layernames - instead you can immediately 'get' the correct name by layer! It's magic! Almost!

    The trick is to use a Javascript object rather than a table. JavaScript objects are nothing special; "Layers" of Illustrator are an array of objects, and each object 'sex' has a 'name' property, which you can read and set the value. What I do here, is to create a new object, where the part 'name' is the name of the original layer and its value is the name of the new layer. All you need to check each layer is if there is a "object.originalLayerName" property and if so, assign its value to this layer name.

    It looks a bit like the table above, except that (1) you use {.} instead of [..] to create an object and (2) you add pairs "name: value" instead of 'value' only (in fact, the 'name' of a value in a table is simply her number).

    So here's what it looks like:

    // JavaScript Document
    var doc = app.activeDocument;
    // name indexed object
    var layernames = {
     'FHairBowlBoy *Hair':'Hairboy1',
     'FHairCurlyafroBoy *Hair':'Hairboy2',
     'FHairSpikyBoy *Hair':'Hairboy3'
    };
    // loop through all layers
    for (var i = 0; i < doc.layers.length; i++)
    {
     //Set up Variable to access layer name
     var currentLayer = app.activeDocument.layers[i];
     if (layernames[currentLayer.name])
     {
      currentLayer.name = layernames[currentLayer.name];
     }
    }
    

    Enjoy!

  • Legend of failure to replace the caption text

    Hello

    How would I be able to achieve the following in Captivate 5:

    Location:

    I have an image, a clickbox on it and a text caption requiring the learner to click the clickbox. If someone clicks on the clickbox, a legend of the failure appears.

    I'm looking for:

    Currently, the legend of failure shows for the duration of the slide (3 seconds), then he disappears and returns to the text caption. However, I want the legend of failure to replace the text of the caption completely.

    Can anyone advise me on what I should do?

    Thank you!!

    Hello BettinaK,

    Welcome to the Adobe forums.

    You can set the timing for the legend text in its properties lets say 3 seconds. After 3 seconds, it will disappear.

    Now if the user clicks the clickbox, you will get 'type text of failure here', you can click on it and set the ignition for it, like the rest of the slide.

    Here are the screenshots

    Step 1 > your slide is something like this (I'm sorry to not use any image of the slide)

    Step 2 > now you can set the timing for the text of the legend (click here). Here I put it for only 3 seconds, so it will disappear after 3 seconds

    Step 3 > now click on 'Failure Type here text' and adjust the ignition in his properties as well

    By doin this failure of Type here text appears for the duration that you want and it will take the place of the legend text

    I hope that helps!

    Vishal

  • Reduction/elimination of the layer text

    Hey everybody,

    I create a t-shirt design where I have a word 'EMS' passes over a layer. The "M" I had to bring black because the picture is white. The rest of the EMS is also white. The background is transperant, so what I'm trying to do, it's also make transparent "M". This way, when put on a shirt in the color of the "M" will be just the color of the shirt.

    I searched everywhere for an answer on how to do it and I think it will be very simple.

    Any help with this would be greatly appreciated!

    You can do this with layer masks.

    First of all, start by having your "M" on a separate layer.

    Select your "M" layer and right-click. Then, click on 'Create work Path' as shown below.

    Click on the tab 'Path' next 'Layers' and 'channels '. Then, right-click on the way to work that you made earlier, and then click 'Make selection'

    A menu of 'Make selection' (see below) will be pop up, change 'feather RADIUS' to 0 and click ok. What you do here, is to make a selection of your "M".

    After you have selected your "M" shape, you will want to select the reverse of it, so that everything EXCEPT the "M" is selected. To do this go to select-> Inverse

    Now that we have made the right choice, we will create the mask later. Click on the button 'Add layer mask' below

    We're almost done! Your image should look like this, so far:

    Now move your layer of "M" in the right place with the move tool.

    Now copy this layer mask on your white shape layer (or use whatever photo/image you.) to do this, click on the layer mask and press the ALT key when you drag down on the white shape layer.

    If done correctly, you should see the layer mask on both layers. and your "M" will look like 'cut '. Now you can hide your "M" type layer, and you're done!

    I hope this helps!

    Julia

  • by dragging the layer to open limited image

    CS5-

    the area below the panels open restricted dragging layers, tested OK on my CS4 version and seems to be a new problem. This is true if you drag the image area or the layers panel.

    See below (area inside the red line does not allow the layer to drag in this region):

    dragDropV1.jpg

    This problem has been fixed in the 12.0.2 update.

  • Download file to replace the existing one, without change of name

    We have files on our server that we need to have dedicated and stable names, like change us them periodically and we always want to have the same name. When download us them through Contribute, the software automatically adds a suffix to them, making them not the same file name to one that we need to replace. I can understand why this might do it for security reasons, if someone changes the file and then replace the work of someone, say. But we want to disable it.

    For example, if I have a file named form.pdf, when I made edits to it, I need to replace the previous version of form.pdf. Instead, Contribute calls this form of form001.pdf, which makes it DO NOT crush him.

    Is that somewhere in the permissions? Help, please.

    Thank you

    Annie

    To get the right to replace the similar version of orPublish,

    activate the option "Allow users to delete files, they are allowed to change" in the edit role setting dialog box.

    To reach this dialog,

    1. Administer the Web site.
    2. Select the role you want to make this setting.
    3. Click on change settings for role...
    4. Select the folder/file access category.

    Hope this helps you.

  • Invert the colors in the layer text and background

    Hello

    Can someone please guide me through do reverse my position.

    Basically, I created an outline of buildings in the background using the pen tool - this part is fine. Then I had filled white buildings inside and outside with black.

    Then I have the text layer. Now, I want to have the text overlapping the two portions of the black and white of the background while being in the Middle, and the problem I am facing is I'm trying to make sense of the texts that overlaps the black area to be white and black when he rides the white area.

    So just a summary:

    Question #1: How can I go to do this inversion of color?

    Question #2: Just another question - is there a better way to create sharp backgrounds? I basically used the pen tool to create rectangular shapes, a little inclined to the buildings in the background - the area selected and filled with the foreground color, which, in my case, I chose white. I left at 0 Pixels and checked anti-aliasing when I chose the area by the way. I'll get this pattern printed on a black shirt, then I want the lines to be as sharp as possible, if someone can you please advise me if I don't do something right in the above. Kindly let me know if there are better ways to do it as well.

    I thank you all in advance and have a nice day!

    Javier

    Type white and use the Exclusion blend mode.

  • Acrobat pro XI: how to accept a comment, and then replace the old text?

    My Office Manager began a PDF for review through four managers and sent me the PDF commented to change.  In WORD, there is a button I accept and changes are corrected in the original doc.

    I see all kinds of information on the management of comments, print them etc, but none on the execution of this function which makes of the WORD.

    I try to cut and paste all (271) comments in a word doc so I don't have to do this again.

    Any suggestions before I lose half of my day?

    Hi stephens78119216,

    I'm sorry, but unlike word, there no function in Acrobat to accept changes made in the document.

    Although you can follow reviews added in the PDF file.

    Ref: Acrobat Help. Follow-up and management of PDF comments on

    Kind regards

    Ana Maria

Maybe you are looking for