Edit 'Add to file names'

I am a complete Newbie to Applescript but I'd like to try and generate a script which does the following:
- use all selected items in the Finder (image files)
- show a list with several options for names and events
- let me select from the list
- add the name of the choice (eg. "Christmas" or "mom's birthday") to the end of the filename, but before the extension (so that I dont get files with .jpgChristmas as an extension). I would also be ok to first remove or hide the extension to avoid this problem.
I have been looking at the 'Add to file names' Applescript sample script and I think it should be doable to edit it to do what I mentioned above. I figured I should use
tell application "Finder" to set ItemList to selection
to do the first step, namely use only selected items in the finder instead of the whole folder (as the sample script does).
After this I get quite lost in the documentation... is there anyone that could help me out?
Thanks a bunch!

You can get the name and name extension properties of an item and use that to break the name apart, for example:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #DAFFB6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
property theOptions : {"Christmas", "Mom's birthday"}
property divider : "_" -- a divider between the name and the suffix
set suffix to (choose from list theOptions with prompt "Choose a name suffix:" with empty selection allowed) as text
if suffix is in {"", "false"} then return -- nothing added
tell application "Finder" to repeat with anItem in (get the selection)
set {theName, theExtension} to {name, name extension} of anItem
if theExtension is in {missing value, ""} then
set theExtension to ""
else
set theExtension to "." & theExtension
end if
set theName to text 1 thru -((count theExtension) + 1) of theName -- the name part
set name of anItem to theName & divider & suffix & theExtension -- rename
end repeat
</pre>

Similar Messages

  • How to alter 'add to file names' script?

    I'm working on some stuff that I need to get done today, and it dawned on me that I could save a lot of time if I had a certain script perform a simple task for me. Unfortunately I haven't been able to get one to work right. I just want to be able to add the same thing onto the end of a file name... For instance, 01.jpg would become 01x.jpg, 02.jpg becomes 02x.jpg and so on. The basic 'Add to File Names' script will almost work, but it adds to the front of the name, not the back. Does anyone know how I could alter the lines in that script to get it to do what I want?
    Thanks for any help,
    Dave

    01. Under 'Alternative 01:', the line ...
    No error checking for folders is included. Such is an exercise for the student.
    ... should have been ...
    --No error checking for folders is included. Such is an exercise for the student.
    02. The error message ...
    "System Events got an Error: NSCannotCreateScriptCommandError".
    Hmmm, those replying are using MacOS X 10.4.x, and you are using MacOS X 10.2.x. Others, with Macs running MacOS X 10.2.x and using AppleScript code from MacOS X 10.3.x and later, do at times experience 'NSCannotCreateScriptCommandError' error messages.
    In the code below, 'System Events' was replaced with 'Finder'. Some additional editing was performed, where required.
    Alternative 01:
    property tAddition : "x" -- The charcter or string to append to the files' name.
    tell application "Finder"
    set tSelection to selection
    --No error checking for folders is included. Such is an exercise for the student.
    repeat with i in tSelection -- Cycle through the provided files.
    set {displayed_name, name_Extension} to {displayed name of (i as alias), name extension of (i as alias)}
    if ((displayed_name ends with name_Extension) and ((count name_Extension) > 0)) then
    -- Handle file names which include a name extension.
    set (name of i) to ((get (characters 1 through ((count displayed_name) - (count name_Extension) - 1) of displayed_name) as string) & tAddition & "." & name_Extension)
    else
    set (name of i) to (displayed_name & tAddition) -- Handle file names without a name extension.
    end if
    end repeat
    end tell
    Save the AppleScript code as a script.
    Move file (or a copy or alias of the file) to the '~/Library/Scripts/' folder.
    Select files to be processed, in 'Finder'.
    Select the script, via the 'Script menu'.
    Alternative 02:
    property tAddition : "x" -- The charcter or string to append to the files' name.
    on run {} -- User double-click on the applet.
    display dialog "Drag file(s) onto applet for processing."
    end run
    on open selected_Items -- User dragged items onto applet.
    my handleitems(selectedItems) -- Processed items dragged onto applet.
    end open
    on handleitems(localItems)
    -- No error checking for folders is included. Such is an exercise for the student.
    tell application "Finder"
    repeat with i in local_Items -- Cycle through the provided files.
    set {displayed_name, name_Extension} to {displayed name of i, name extension of i}
    if ((displayed_name ends with name_Extension) and ((count name_Extension) > 0)) then
    -- Handle file names which include a name extension.
    set (name of i) to ((get (characters 1 through ((count displayed_name) - (count name_Extension) - 1) of displayed_name) as string) & tAddition & "." & name_Extension)
    else
    set (name of i) to (displayed_name & tAddition) -- Handle file names without a name extension.
    end if
    end repeat
    end tell
    end handle_items
    Save the AppleScript code as an applet (application).
    Drag files to be processed, onto the applet, in 'Finder'.

  • How can i add a file name(the text of the file name) as a child node to existing node in a treeView1 ?

    bool exists = false;
    TreeNode newNodeParsed = null;
    TreeNode rootNode = treeViewMS1.Nodes[0];
    TreeNode nextNode = rootNode;
    string f = Path.GetFileName(txtUploadFile.Text);
    TreeNode subnode = new TreeNode(txtDir.Text);
    TreeNode filename = new TreeNode(f);
    if (!txtDir.Text.Contains("/"))
    foreach (TreeNode node in rootNode.Nodes)
    if (node.Text == txtDir.Text)
    exists = true;
    break;
    if (exists == true)
    subnode.Nodes.Add(f);
    else
    rootNode.Nodes.Add(subnode);
    subnode.Nodes.Add(f);
    The rootNode is the root directory in the treeView1
    subnode is a node inside the root. For example the subnode name is manuelisback
    I'm checking if the subnode exist i want to add the file for example (lightning1.jpg) to be under subnode.
    If the subnode is not existing add the subnode to the root and then add the file name lightning1.jpg under the subnode.
    But the file name is never added under the subnode:
    I added manualy the lightning1.jpg under test.
    But the lightning1.jpg also should be added to be under manuelisback. There should be two lightning1.jpg here.
    One under manuelisback and one under test. The one under test i added manualy from my ftp server.
    But the one i want to be under manuelisback i'm trying to add from my program and it dosen't add it to there.
    And when i'm using a breakpoint i see on subnode the text manuelisback and i see on f the text lightning1.jpg

    If I understand your question correctly, you might want to try changing:
    if (!txtDir.Text.Contains("/"))
    foreach (TreeNode node in rootNode.Nodes)
    if (node.Text == txtDir.Text)
    exists = true;
    break;
    if (exists == true)
    subnode.Nodes.Add(f);
    else
    rootNode.Nodes.Add(subnode);
    subnode.Nodes.Add(f);
    to something like:
    if (!txtDir.Text.Contains("/"))
    foreach (TreeNode node in rootNode.Nodes)
    if (node.Text == txtDir.Text)
    subnode = node;
    exists = true;
    break;
    if (exists == true)
    subnode.Nodes.Add(f);
    else
    rootNode.Nodes.Add(subnode);
    subnode.Nodes.Add(f);
    rootNode.Nodes.Add(f);
    It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.

  • AppleScript "Add to File Names.scpt" (in Finder Scripts) adds "Prefix" to end of files rather than adding actual prefix?

    This may be a quirk with my setup, but when the file "Add to File Names.scpt" runs in Mavericks "Prefix" is appended to the end of filenames rather than the term I would like to be added as a prefix...unsure if this can be reproduced on other comptuers? Similarly, as a test, if a term is intended to be added as a suffix to a file name then "Suffix" is appended to the end of a file name - rather than the term.
    If this is a bug is there a fix?
    Thanks

    apparently this is a bug with a workaround as described here:
    https://discussions.apple.com/message/24085265#24085265

  • Add arabic file names to ZipOutputStream problem

    Dear All,
    i have problem with add arabic file names to ZipOutputStream problem my sample code :
    zipOutputStream.putNextEntry("&#1593;&#1585;&#1576;&#1610;.txt");//some arabic text
    the zip file created successfully and contain files but the files in the zip file with name '??????????.txt'.i use many character set to encode arabic file name such as utf-8,windows-1256,iso-8859-1,IBM437 but the name changed to someting cannot understand lik '_&#1583;_&#1587;_&#1584;_&#1583;_&#1586; ___«___è_&#1585;1.txt' or '??????????.txt'.
    is there anyone to help
    with regards
    Wa'el Abu Rahmeh

    Its a warning. You can ignore it, and your program will run correctly.
    To get the full details, follow the instructions and run it with Xlint:
    javac -Xlint:unchecked beans\CustomerManager.javaProduces this error message:
    beans\CustomerManager.java:19: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
                rv.add(getCustomer(String.valueOf(i)));
                      ^
    1 warningIt is a Java1.5 specific warning because you are not using the new Generics info with the collections.
    Here is the version that compiles with no warnings whatsoever.
    package beans;
    import java.util.ArrayList;
    import java.util.List;
    public class CustomerManager
        public List<Customer> getCustomers()
            return generateCustomers();
        private List<Customer> generateCustomers()
            List<Customer> rv = new ArrayList<Customer>();
            for (int i = 0; i < 10; i++)
                rv.add(getCustomer(String.valueOf(i)));
            return rv;
        public Customer getCustomer(String id)
            return new Customer(id, id + "First", "Last" + id,
                "123 Caroline Road Fooville");
    }Basically the change was everywhere you have List or ArrayList replace it with List<Customer> - meaning you have a List of customer objects, rather than just a List of "anything"
    If you are compiling with jdk1.5, then anywhere you use a Collection without specifying the types in this manner, it will create a warning.
    You can ignore the warning if you so wish, and the program should run fine.
    Cheers,
    evnafets

  • Can I add the file name and page numbers to multiple pdfs automatically?

    Hello.  Thanks first for taking the time to read this!  We are a small non profit hospice.  Looking to take a large amount of files and put the patients last name (which is the file name) and a page number on the footer of every page of every document.  For example.  File Name Smith.  Smith 1 Smith 2 Smith 3 etc.  However I like to be able to do this to multiple files at once and not have to open each one up.

    Go to Advanced - Document Processing - Batch Processing...
    Click New Sequence and give it a name.
    Now select the sequence you've created, click Edit Sequence, click Select Commands.
    Select Execute JavaScript from the left-hand side, and click Add.
    Now select it on the right-hand side and click Edit.
    Paste the code from my previous post into the window, and click OK twice.
    Now, back in the Edit Sequence window, select the folder you want to run the batch on, and the output folder. Be aware that if you choose the same folder, the original files will be overwritten, so you might want to use a different one.
    Under Source File Options, deselect everything.
    Click OK.
    You're now ready to run the batch sequence!

  • How to Edit the Title (file name) on forms 10g Screen.

    Hi ,
    How can one edit the Title ,and <(file name)> on forms 10g Screen ....
    I tried editing through the forms module preperty palette , but could n't change the Title, or file name on forms menu screen ...
    I guess , the entries are made through some other means...
    Please let me know on how to do this .
    Need a quicker reply ..
    Thanks in Advance
    Sanu

    using the below code too not getting me the new names entered by me ... still the old title names are comingWhat do you mean by new nemes? It will return you the actual file name which is saved in phycical location and form name will return you the module name which displays when you open forms in builder.
    Or you mean something else then its better to provide any example..like what is happening actually with you.
    -Ammad

  • Add source file name to output table

    Hi, I am trying to pull data from Azure blob to On Premises SQL Database. I have emp file that have three columns (Id, FirstName, LastName) and SQL table has five columns (Id, Firstname, LastName, SourceFileName, Lastmodifieddatetime). Is there any way to
    map SourceFileName and Lastmodifieddatetime in the Azure Data Factory.
    Thanks,
    Gaurav

    OK, got it. The file name iws not updated until the file is closed and opened.
    I will add the variableto the topics in question.

  • Exporting as jpeg with use artboards adds to file name

    When I export from Illustrator CS5 with "Use Artboards" checked it adds a "-01" to the end of my file name before the extention. I'm assuming that its because its artboard #1 or something. It happens with the all or the range button checked. It doesnt show the -01 when you are saving the file name. This is pretty annoying because I have to go back and re name the files when this happens. Any advice? Thanks!

    Same problem, Gex.
    Been trying to get this resolved for months with no joy. I have recently produced over 250 brand logos for a large multi national, all of which have to supplied in various formats and file types including .jpg. I too use only one artboard and since I don't want the logos cropped tight to the image, I check "use artboard" with the result that I get logoname-01.jpg on every file.
    It may not seem to be too much of a sweat to then delete the offending -01 from the resulting file name, but when you have to do this repeatedly it is extremely tiresome... and so unnecessary!! I too do not want, or need, to append the file name with anything at all.
    I really am at a loss to know why, if i have one artboard (AND ONLY ONE) it has to have a number at all. With 2 or more artboards, sure, it may be useful to identify each, but with 1... that is it, that is all there is. The only one. One of one. No more, no less. Very little chance of confusion i would have thought!
    So, Adobe can we have a radio button (or preference) along the lines of: "add pasteboard number" or "remove pasteboard number" or perhaps a more enlightened soul at Adobe can respond with a workaround (unlikely, it is Adobe after all!).

  • How do you add the files name to images within a PDF

    I have been searching the web trying to find an answer to this question, I am not sure what the proper term is called, but I refer to it as a 'coded pdf'. Hopefully someone knows what I am talking about and can help me find an answer!
    The end product is a coded PDF that has the file name of all the images lableled on top the image. For example, a product brochure that has 500 images, all of them would be 'coded' with their file name, to find easy in source files. - Is this an export option in InDesign, or an option somewhere in Acrobat?
    Thank you in advance for any help.
    -Melissa

    No, Melissa's asking for a filename that's searchable - text made of pixels is no use.
    Acrobat cannot apply the original image filenames after the PDF has been created as it can't read the information from anywhere. You have two options, both in InDesign:
    use smart captions to add the name of the file in a visible format beside each image.
    use accessibility tagging and place the image filename in the ALT TEXT field, then export the PDF with tags enabled (the filename will not be visible on the page but will show if you hover your mouse over the image).

  • Odd add'l file names in ripped iTunes folders (like "._01 songname.mp3")

    Lately when I rip from my iMac into a shared iTunes library from which I also sync Windows computers, I see files like "._01 songname.mp3" in addition to "songname.mp3". These odd files are very small. I also rip on my Windows PC -- these don't seem to create those files. Then, I've been copying them to SD cards to copy to the HD in my new car stereo and then end up there, but are not playable. What are they? Do I need them at all? Can I delete them on my file server? (I know I can delete them on my SD card and car HD.) But, what are they and can I delete them all over?
    Thanks for any ideas.
    -Bruce
    PS: I've seen files before called "albumart" something when I've ripped a CD and there was no artwork for it in the iTunes store and I copy something from say the Amazon store.

    Matt,
    When you burn the MP3 CD with iTunes, it names each file on the CD as "number title," independent of what the original file name was. The number corresponds to its position in the playlist from which you are burning. (It does not modify the filename on your hard drive.)
    I believe that will accomplish the sequencing you are looking for. Give it a try and let us know.
    Ed

  • Add Original File Name in Exported Photo Metadata

    It would be helpful if LR added the original filename from which the exported file was created. Like in Camera Raw, you can find the original filename of the RAW file in the metadata of files created and saved with ACR.
    Thanks for listening.

    Yes, you can use the Original filename token to be included as part of the exported filename, but the value disappears from the exported image's metadata. And I think that is what the OP is looking for. It appears that the Original Filename, which can be seen in the metadata panel for raw files, disappears in the exported image regardless of how it is exported (DNG, TIF, JPG, etc.).
    If you open an raw image in PS and look for the Original Filename in the Advanced panel of File Info, it can't be found (at least I can't find it). So maybe this is a metadata field that is internal to LR, and can only be used to rename files within LR.

  • How to add new text and an empty space before a file name with Automator

    I can create a new service to add to multiple files some text before the file name but I need to add even an empty space; e.g. file name original  becomes: new text(space)file name original. The aim is to add this text and space to multiple files.
    I hope to be understood. Please can somebody help me?
    Thanks

    This is an old Apple-supplied AppleScript that will do the job.
    IMPORTANT: note the conditions of use: it will choose the frontmost Finder window to operate on. Therefore, open the folder you want to change the names of and make it the front finder window BEFORE running the script.
    Add to File Names
    This script is designed to add a prefix or suffix to files in the front window of the desktop.
    If no folder windows are open, the script will affect items on the desktop.
    Copyright © 2001–2007 Apple Inc.
    You may incorporate this Apple sample code into your program(s) without
    restriction.  This Apple sample code has been provided "AS IS" and the
    responsibility for its operation is yours.  You are not permitted to
    redistribute this Apple sample code as "Apple sample code" after having
    made changes.  If you're going to redistribute the code, we require
    that you make it clear that the code was descended from Apple sample
    code, but that you've made changes.
    --March 2014: Changes by Phil Stokes to make the script work on 10.9
    --these changes are simply reversing the order of parameters in the lines that have "copy" in them
    -- The following line is disabled due to a Menu Manager bug
    --set the source_folder to (choose folder with prompt "Pick the folder containing the files to rename:")
    try
              tell application "Finder" to set the source_folder to (folder of the front window) as alias
    on error -- no open folder windows
              set the source_folder to path to desktop folder as alias
    end try
    set the prefix_or_suffix to ""
    repeat
              display dialog "Enter the prefix or suffix to use:" default answer the prefix_or_suffix buttons {"Cancel", "Prefix", "Suffix"}
              copy the result as list to {button_pressed, prefix_or_suffix}
              if the prefix_or_suffix is not "" then exit repeat
    end repeat
    set the item_list to list folder source_folder without invisibles
    set source_folder to source_folder as string
    repeat with i from 1 to number of items in the item_list
              set this_item to item i of the item_list
              set this_item to (source_folder & this_item) as alias
              set this_info to info for this_item
              set the current_name to the name of this_info
              if folder of this_info is false and ¬
                        alias of this_info is false then
                        if the button_pressed is "Prefix" then
                                  set the new_file_name to the (the prefix_or_suffix & the current_name) as string
                        else
                                  set the new_file_name to the (the current_name & the prefix_or_suffix) as string
                        end if
                        my set_item_name(this_item, the new_file_name)
              end if
    end repeat
    beep 2
    on set_item_name(this_item, new_item_name)
              tell application "Finder"
      --activate
                        set the parent_container_path to (the container of this_item) as text
                        if not (exists item (the parent_container_path & new_item_name)) then
                                  try
                                            set the name of this_item to new_item_name
                                  on error the error_message number the error_number
                                            if the error_number is -59 then
                                                      set the error_message to "This name contains improper characters, such as a colon (:)."
                                            else --the suggested name is too long
                                                      set the error_message to error_message -- "The name is more than 31 characters long."
                                            end if
      --beep
                                            tell me to display dialog the error_message default answer new_item_name buttons {"Cancel", "Skip", "OK"} default button 3
                                            copy the result as list to {button_pressed, new_item_name}
                                            if the button_pressed is "Skip" then return 0
                                            my set_item_name(this_item, new_item_name)
                                  end try
                        else --the name already exists
      --beep
                                  tell me to display dialog "This name is already taken, please rename." default answer new_item_name buttons {"Cancel", "Skip", "OK"} default button 3
                                  copy the result as list to {button_pressed, new_item_name}
                                  if the button_pressed is "Skip" then return 0
                                  my set_item_name(this_item, new_item_name)
                        end if
              end tell
    end set_item_name

  • Add file name script not working in CS3

    I have this wonderful script (written by Brian Price) back in 2004 for PS7 that adds the file name to an image ( I use it for adding file names to small images to be used in a slideshow). It works great ion Photoshop CS, but when I try to use it as part of a batch action in CS3 it stalls on line 9. OIt works fine when run on just one image in CS3 . . . it just stalls when run as part of a batch action!
    Any help GREATLY appreciated!
    Many Thanks,
    Peter Thompson
    [email protected]
    www.photohawaii.com
    Here's the script:
    // this script is a variation of the script addTimeStamp.js that is installed with PS7
    //Copyright 2002-2003. Adobe Systems, Incorporated. All rights reserved.
    //All amendments Copyright Brian Price 2004 ([email protected])
    //Check if a document is open
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PERCENT;
    try
    var docRef = activeDocument;
    // Create a text layer at the front
    var myLayerRef = docRef.artLayers.add();
    myLayerRef.kind = LayerKind.TEXT;
    myLayerRef.name = "Filename";
    var myTextRef = myLayerRef.textItem;
    //Set your parameters below this line
    //If you wish to show the file extension, change the n to y in the line below, if not use n.
    var ShowExtension = "n";
    // Insert any text to appear before the filename, such as your name and copyright info between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextBefore = "";
    // Insert any text to appear after the filename between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextAfter = "";
    // Set font size in Points
    myTextRef.size = 30;
    //Set font - use GetFontName.js to get exact name
    myTextRef.font = "ComicSansMS";
    //Set text colour in RGB values
    var newColor = new SolidColor();
    newColor.rgb.red = 255;
    newColor.rgb.green = 255;
    newColor.rgb.blue = 0;
    myTextRef.color = newColor;
    // Set the position of the text - percentages from left first, then from top.
    myTextRef.position = new Array( 5, 94);
    // 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
    di=(docRef.name).indexOf(".");
    fname = (docRef.name).substr(0, di);
    //use extension if set
    if ( ShowExtension == "y" )
    fname = docRef.name
    myTextRef.contents = TextBefore + " " + fname + " " + TextAfter;
    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!" );

    I have this wonderful script (written by Brian Price) back in 2004 for PS7 that adds the file name to an image ( I use it for adding file names to small images to be used in a slideshow). It works great ion Photoshop CS, but when I try to use it as part of a batch action in CS3 it stalls on line 9. OIt works fine when run on just one image in CS3 . . . it just stalls when run as part of a batch action!
    Any help GREATLY appreciated!
    Many Thanks,
    Peter Thompson
    [email protected]
    www.photohawaii.com
    Here's the script:
    // this script is a variation of the script addTimeStamp.js that is installed with PS7
    //Copyright 2002-2003. Adobe Systems, Incorporated. All rights reserved.
    //All amendments Copyright Brian Price 2004 ([email protected])
    //Check if a document is open
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PERCENT;
    try
    var docRef = activeDocument;
    // Create a text layer at the front
    var myLayerRef = docRef.artLayers.add();
    myLayerRef.kind = LayerKind.TEXT;
    myLayerRef.name = "Filename";
    var myTextRef = myLayerRef.textItem;
    //Set your parameters below this line
    //If you wish to show the file extension, change the n to y in the line below, if not use n.
    var ShowExtension = "n";
    // Insert any text to appear before the filename, such as your name and copyright info between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextBefore = "";
    // Insert any text to appear after the filename between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextAfter = "";
    // Set font size in Points
    myTextRef.size = 30;
    //Set font - use GetFontName.js to get exact name
    myTextRef.font = "ComicSansMS";
    //Set text colour in RGB values
    var newColor = new SolidColor();
    newColor.rgb.red = 255;
    newColor.rgb.green = 255;
    newColor.rgb.blue = 0;
    myTextRef.color = newColor;
    // Set the position of the text - percentages from left first, then from top.
    myTextRef.position = new Array( 5, 94);
    // 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
    di=(docRef.name).indexOf(".");
    fname = (docRef.name).substr(0, di);
    //use extension if set
    if ( ShowExtension == "y" )
    fname = docRef.name
    myTextRef.contents = TextBefore + " " + fname + " " + TextAfter;
    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!" );

  • How can I Bulk add file name to picture

    I want to add the file name to the picture, so that when people look at the picture the file name is embedded into the picture.
    I have done some research on this top and have found some mention of tools that people have build to do this and indeed many different things I suppose.
    Im using PSE 10. Windows 7 Prof.  From what I understand, I cant build tools because my version eg Elements is not full blown. But if people have build something to do this I can then add it to my software and it will function for me.
    While in full, quick or even guided there appears to be an option under File/Automation Tools. This appears to be what I need.
    Can anyone tell me where this add on is and how to use it, I cant seem to find it and I really dont know if it will work with PSE 10. Many of the refrences I have seen seem to be for earlier version.
    Perhaps there is an easier way ??
    Thanks

    Good question.
    Basically what I want is the name of the photo name actually in the photo.  I have 400 pictues, I want to put them into a digital picture frame, and I want each picture to be display with the name of the pictures eg. Florida 2012.jpg and Grand Canyon.jpg. Of course I dont need the .jpg extention. But If it is there I can live with it. Im not sure if the Caption option in photoshop elements  can be exported so that the caption is hard wired into the picture. maybe it is. HOWEVER, what I dont want to do is go through 400 pictures and type in the caption for each pictures, if this option is available. It would be nice if the utility copyed the fild name into the caption, if you  could save it with the caption name, but I think Im asking too much.
    Anyway basically I want the file name build into the  photo how ever this could be done in a bulk mode.
    Is that  a lttle clearer. Here is an examle worth a 1000 words.
    BTW I did an experiment and if you put the name in the caption line of the photo. It does not get exported with the file name in the picture. ( which I would asume since not many want the name in the photo, ) Although maybe there is some option that can be turned on to do this ??
    Regards

Maybe you are looking for