Set file names to text

I'm looking for an action that will take files as input and output the file names as text. Does anyone know of an included or free action to do this?
Message was edited by: KatieS1975

You can use AppleScript's text item delimiters to add some text between the (text) items when converting the input list to text:
<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: #FFEE80;
overflow: auto;"
title="this text can be pasted into the Script Editor">
on run {input, parameters} -- convert the input list to text using the specified delimiter
try
set tempTID to AppleScript's text item delimiters -- save the current delimiter
set AppleScript's text item delimiters to return -- change the delimiting text as desired
set the output to the input as text
set AppleScript's text item delimiters to tempTID
on error errorMessage number errorNumber -- restore the original delimiter before passing on the error
set AppleScript's text item delimiters to tempTID
error errMessage number errorNumber
end try
return the output
end run
</pre>

Similar Messages

  • Get picture's file name to text

    How can I set an InDesign template that to get a placed object's file name and write it down, without the extension, in a text box near it? I have to make a large list of people, all the jpg-s are named with their names, and I have to write down the names near. I was thinking of a template with a placeholder for the picture and a placeholder for the text, that gets the picture's name. Have any better ideea guys?

    I've tried them out, but haven't manage yet to create a template of my own. Can i "convince" InDesign to pun only 3 images on a page, in specific locations? How can I make contact sheets work on different master pages? I mean arranging pictures on different layouts, in the same document.

  • Setting File Name in response

    Hi,
    On server side I read the (Pdf) file and then stream the file content thru response object so that this pdf file opens in browser using Adobe reader. This works just fine.
    And right now, if user wants to save this file in browser, complete jsp url appears as file name in save as dialog box.
    For eg.:
    If my jsp has stream the pdf file from this url
    http://www.xy.com/jsp/displayFileJsp?f=xyz.pdf
    then
    when user tries to save this file, browser save as dialog displays file name as "http://www.xy.com/jsp/displayFileJsp?f=xyz.pdf"
    But I want user should download that file name with specific file name like xyz.pdf.
    I tried to set the content type
    response.setHeader("Content-Disposition", " filename=xyz.pdf" );
    But it didn't work.
    any suggestions ?
    rk

    i have created a zip file and i have to make it downloadable i.e. pop-up box should be invoked. my code is
    try {    
              outFilename = "D:\\Product.zip";
              ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
              for (int i=0; i<filenames.length; i++) {
              FileInputStream in = new FileInputStream(filenames);
              out.putNextEntry(new ZipEntry(filenames[i]));
              int len;
              while ((len = in.read(buf)) > 0) {
              out.write(buf, 0, len);
              out.closeEntry();
              in.close();
              out.close();
              catch (IOException e)
                   e.printStackTrace();
              String d1file = outFilename;
              File f1 = new File (d1file);
                   response.setContentType ("text/plain");
                   response.setHeader("Content-Disposition", "attachment;filename=\"" + d1file + "\"");
              try { 
              InputStream in = new FileInputStream(f1);
              ServletOutputStream outs = response.getOutputStream();
              int bit = 256;
                   while ((bit) >= 0)
                        bit = in.read();
                        outs.write(bit);
                   outs.flush();
                   outs.close();
                   in.close();
              catch (IOException ioe)
                   ioe.printStackTrace(System.out);
    it is creating zip file and placing it at D:\\ . I want to invoke download "Save As" pop up box, which is not appearing here! what should I do?

  • Set file name as a variable. Then use it to name a folder

    I'm making a workflow that I want to get the selected file, then create a new folder using that file's name. I made a workflow as follows:
    Get selected Finder Item (In this case a JPG image)
    Set Value of Variable
    New Folder (dragging the variable from 'Set Value of Variable')
    But running this workflow it adds the path of the file to the new folders name, as well as the file's name (e.g. instead of the folder being called 'Photo1' it's called '/Users/Jono/Desktop/Photo1.jpg').
    Does anybody know how I could get it to just the file name (preferably without the extension) instead of prefixing it with the path?

    The New Folder action uses the specified text for the file name. The following Run AppleScript action will return just the names of the Finder Items passed to it:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters}
    get a name from a file path
    input: a list of Finder Items (aliases)
    output: a list of names
    set output to {}
    repeat with AnItem in the input -- step through each item in the input
    set {name:TheName, name extension:TheExtension} to (info for AnItem)
    if TheExtension is missing value then set TheExtension to ""
    set end of output to (text 1 thru -((count TheExtension) + 2) of TheName) -- just the name part
    end repeat
    return the output -- pass the result(s) to the next action
    end run
    </pre>

  • Cannot set file name

    I'm trying to write a script to rename all of the files in a folder using regular expressions. I can tell when I run it that I am correctly changing the names of the files the way I want; the problem comes when I try to set the name. I get this error:
    error "Finder got an error: Can’t set file \"[first file]\" to \"[new name]\"." number -10006 from file "[first file]"
    I've tried looking on over a dozen forums and tutorial sites, and as far as I can tell, I'm doing the right thing! Can someone please help?
    tell application "Finder"
              set f to "Example:"
              set fileNames to name of files of folder f
    end tell
    repeat with aFile in fileNames
              tell application "System Events"
                        considering case
                                  set episode to aFile
                                  set episode to my switchText(episode, "[", "- ")
                                  set episode to my switchText(episode, "]", " -")
                                  set episode to my switchText(episode, "x0", "0")
                                  set episode to my switchText(episode, "x1", "1")
                                  set episode to my switchText(episode, "x2", "2")
                        end considering
              end tell
              tell application "Finder"
                        set fileName to (a reference to file aFile)
                        set name of fileName to episode                 <<------------------error
              end tell
    end repeat
    to switchText(theText, SearchString, ReplaceString)
              set OldDelims to AppleScript's AppleScript's text item delimiters
              set AppleScript's AppleScript's text item delimiters to SearchString
              set newText to text items of theText
              set AppleScript's AppleScript's text item delimiters to ReplaceString
              set newText to newText as text
              set AppleScript's AppleScript's text item delimiters to OldDelims
              return newText
    end switchText

    Try replacing
        tell application "Finder"
            set fileName to (a reference to file aFile)
            set name of fileName to episode
        end tell
    with
        tell application "Finder"
            set name of file aFile of folder f to episode
        end tell

  • 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.

  • Chain interfaces to set file name in sender channel dynamically

    Hi,
    I have a requirement to use the Seeburger SFTP adapter to import a file from an external server to an SAP ECC system.
    The adapter must be Seeburger as the protocol has to be SFTP, not FTPS as with the File adapter.
    Although I can set a wildcard selection, I really want to poll for specific filenames with predetermined naming criteria.
    The sender SFTP communication channel doesn't provide any options to specify dynamic attributes but I wonder if I can link several interfaces together, please can you confirm if the following process would work conceptually:
    1) SAP ECC program runs and determines the fixed filename that I wish to import (e.g. file_abc123.xml).
    2) SAP ECC program calls an outbound proxy with a mapping to set the relevant parameter in dynamic configuration ('http://seeburger.com/xi' is the namepsace, 'dtSubject' is the parameter name for the filename of the SFTP adapter).  Besides mapping I think the Seeburger attribute mapper module could also be used to set this value.
    3) The outbound proxy is configured on the receiver side to call an SFTP sender channel (with a dummy/blank payload as we're only calling the interface to allow settng of the filename to take place) which links to an inbound service interface on the SAP ECC receiver side. 
    I don't know whether chaining of service interfaces in this fashion (receiving interface also being a sender) is a viable approach or whether there are any alternatives.
    Thanks in advance,
    Alan

    Hi Alan,
    Are the specific file names that you are polling for going to be changing or will they be fixed?  Are each of the unique names going to be processed using the same interface?  If so then I would just create multiple SFTP sender channels that poll at different intervals but use the same mappings, etc.
    Regards,
    Ryan Crosby

  • How to set file name and destination folder without user interaction

    how can I set the file name and destination folder to generate a pdf file like "c:\myfolder\document.pdf" in this folder automatically.
    Is there a tag in .joboptions ?
    Goal: User click print button. In the background a pdf will be generated in e.g. "C:\myfolder\document.pdf".
    that`s it.
    I know that the query dialog for save as can be turned off. But the file name depends on the application.
    Thanks for your help.
    TK

    Hello,
    Please post this  in  PI forums
    Regards, Anil

  • How to set file names?

    Using TCS 5, RH11, FM12, all patched up, if I set a marker, such as "Filename" in FrameMaker, can RoboHelp use the contents of that marker to set the file name of the HTML file it creates? How? Thoughts?
    Cheers,
    Sean

    Hi,
    Thanks for working with me on this. I appreciate your help. The last time I used RoboHelp was when Blue Sky owned it, at the original version 6. I see it has aged logically.
    Cheers,
    Sean

  • Loop Page Style Sheet to set file name.

    I am exporting pages to jpgs and pngs using a script that pulls the name from an applied style sheet.
    http://forums.adobe.com/message/5913479#5913479
    the above works perfectly if I only want to specify one style sheet as the file name.
    the challenge may need to use different style sheets on each page to create the name.
    I am not sure how to loop through each page and grab the style in play.
    or if I need to loop at all.
    This is where I am...
    function MakePNGfile()
         for(var myCounter = 0; myCounter < myDoc.pages.length; myCounter++)
              if (myDoc.pages.item(myCounter).appliedSection.name != "")
                   myDoc.pages.item(myCounter).appliedSection.name = "";
          var myStyle1 = "sheetlabel-text";
          var myStyle2 = "sheetlabel-text-2";
          var myParagraphs = myDoc.pages.item(0).textFrames.item(0).parentStory.paragraphs; 
              var myPageName = myDoc.pages.item(myCounter).name;
          var myPNGPrefix = "";
         for( i = 0; i < myParagraphs.length; i++)
             var paragraph = myParagraphs.item(i);
    if (paragraph = myStyle1)
        (myPNGPrefix = getParagraphContent(myDoc.paragraphStyles.item("sheetlabel-text"),  myDoc.pages.item(myCounter))+ '-0' + myPageName)
    else
        (myPNGPrefix = getParagraphContent(myDoc.paragraphStyles.item("sheetlabel-text-2"),  myDoc.pages.item(myCounter))+ '-0' + myPageName)
    Thanks for your help!

    Good to hear .
    Find attached the next version. You can now insert in 'paraStyleNames' as many style names as you want. The script will check from left to right, if there is one found on the page. If this is true, the script will ignore the other styles.
    Removing leading zero should work now.
    Maybe one problem: If one page contains no style, this page will be exported nevertheless with it’s correct page number, but with the founded text of the previous page. If this can never happen, we are done and you should mark the answer as correct. If this is a real problem for you, please let me know, what should happen in this case and I will try to fix that too.
    // Export pages as JPG with additional info by Kai Rübsamen
    // http://forums.adobe.com/message/6326425#6326425
    main ();
    function main() {
    var curDoc = app.activeDocument;
    // Array of paragraph Style names
    var paraStyleNames = ["h1", "h2"]; // insert here your para names !
    var missingParaStyles = [];
    // check, if the styles are valid
    for ( var p = 0; p < paraStyleNames.length; p++ ) {
        var curName = paraStyleNames[p];
        // if the style is missing, push it to the array
        if ( !curDoc.paragraphStyles.itemByName(curName).isValid ) {
            missingParaStyles.push( curName );
    // if some styles are missing, give an alert
    var nMiss = missingParaStyles.length;
    if ( nMiss > 0 ) {
        var display = missingParaStyles.join( "\r" );
        alert ( "Missing para(s):\r" + display );
        exit();
    // loop through all pages
    for ( var i = 0; i < curDoc.pages.length; i++ ) {
        // the current page
        var curPage = curDoc.pages[i];
        // the current pages name
        var pName = curPage.name;
        // controls the loop
        var controller = true;
        // all paragraphs on the current page
        var allPageParas = curPage.textFrames.everyItem().paragraphs.everyItem().getElements();
        // loop through all paragraphs and check, if one has the para style applied
        for ( var p = 0; p < allPageParas.length; p++ ) {
            if ( !controller ) break;
            // the current para
            var curPara = allPageParas[p];
            // loop through the styles
            for ( var n = 0; n < paraStyleNames.length; n++ ) {
                if ( curPara.appliedParagraphStyle.name == paraStyleNames[n] ) {
                    var paraContents = curPara.contents;
                    var paraString = "-" + paraContents.replace( /\s+$/ , "" ).replace( /\s+/g , "-" ).toLowerCase();
                    controller = false;
                    break;
                } // end if
            } // end for paraStyleNames
        } // end for allPageParas
        //~ var folderPath = "~/-client/JOYS - Just Organize Your Stuff/-Art/-art-book-kindle/";
        var folderPath = Folder.desktop;
        if ( pName < 10 ) {
            var appendix = "-0" + pName + paraString;
        else {
            var appendix = "-" + pName + paraString;
        var filePath = folderPath + "/" + curDoc.name.replace(/\.indd$/,"") + appendix + ".jpg";
        var myFile = File( filePath );
        with ( app.jpegExportPreferences ) {
            jpegQuality = JPEGOptionsQuality.high; // low medium high maximum
            exportResolution = 72;
            jpegExportRange = ExportRangeOrAllPages.exportRange;
            pageString = pName;
        curDoc.exportFile( ExportFormat.jpg, myFile, false );
      } // end for pages
    } // end main
    –Kai

  • Setting File Name inside ABAP mapping

    Hello All,
    We have a requirement where we need to send the IDOC in a flat file format to the destination system which we are doing inside an ABAP mapping. Now we need to set the file name depending on a particular field in the IDOC. For this we need to use the DynamicConfigurationKey class inside our ABAP mapping.
    Can anyone throw some light how to access these Adapter-Specific Attributes inside ABAP mapping?
    Thanks
    Abinash

    guess this is the one
    Re: Abap mapping and variable substitution in File adapter

  • Need help in setting file name with special characters in attachment

    Hi
    We have a requirement where we need to set the file name that contains special characters (like Russian) and send mauil using Java mail.
    If we set the file name as such, the attachment in the email contains garbled filename
    Can you pl let me know how to resolve this?
    We should use the file name as attachment name and this will have say special characters. The receiver who gets the mail should get with the correct attachment name
    One important point.. the attachments are opened from MS outlook.
    Thanks and regards
    Ram
    Edited by: 884910 on 13 Sep, 2011 5:00 AM

    Read the FAQ carefully. You don't need to call encodeText unless you're using a really
    old version of JavaMail.
    And, it depends on whether the mail reader you're using is handling encoded parameters
    according to the (new) MIME standard, or according to the (old) non-standard hack.
    Sadly, without knowing what mail reader the recipient is using, it's impossible to use
    encoded filenames that will work everywhere.

  • Setting file name for a downloaded file

    I've set up a file download using code I've gleaned from jsf forums. However, the file name is not being set correctly. When the user downloads File.doc, it shows up as downloadPage.jsf. Am I setting the header correctly?
    public class VendorInfoBean extends AbstractViewController {
        public VendorInfoBean() {
        public String downloadVendorApp() {
            ExternalContext context = getExternalContext();
            String path = context.getInitParameter("externalFiles");
            String filename = "Vendor_Application_e_Form.doc";
            String fullFileName = path + filename;
            File file = new File(fullFileName);
            HttpServletResponse response = (HttpServletResponse) context.getResponse();
            response.setHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");
            response.setContentLength((int) file.length());
            response.setContentType("application/msword");
            try {
                FileInputStream in = new FileInputStream(file);
                OutputStream out = response.getOutputStream();
                // Copy the contents of the file to the output stream
                byte[] buf = new byte[1024];
                int count;
                while ((count = in.read(buf)) >= 0) {
                    out.write(buf, 0, count);
                in.close();
                //out.write(bytes);
                out.flush();
                out.close();
                FacesContext.getCurrentInstance().responseComplete();
            } catch (IOException ex) {
                ex.printStackTrace();
            return null;
    }

    StringBuffer sbFilename = new StringBuffer();
         sbFilename.append("adeem");
         sbFilename.append(".doc");
    StringBuffer sbContentDispValue = new StringBuffer();
         sbContentDispValue.append("attachment");
         sbContentDispValue.append("; filename=");
         sbContentDispValue.append(sbFilename);
    HttpServletResponse response = (HttpServletResponse) context.getResponse();
    response.setHeader("Content-Disposition", sbContentDispValue.toString());
    i think this will work .. if not let me know i will give some code that will work for u then ...

  • How to get set file name for MessageFileUploadBean in Advanced Table

    Hello Everyone.
        I have a MessageFileUpload item in a advanced table. My requirement is to show file names instead of view when user uploads files. I know how to do this if the item is not inside advancedtable  (by using  uploadBean.setAttributeValue(DOWNLOAD_FILE_NAME,displayNameBoundValue).
    But how to get the different ID's when inside a advanced table?
    Thanks
    Sunny

    try setting a transient view attribute to this message file upload, if you iterate through vo, I hope you can just get the path user browses.
    Regards
    Shobht S

  • How to set file name in a JFileChooser to be some default String?

    Dear all,
    I am tring to make my JFileChooser more user-friendly, so every time that a JFileChooser show up, I would like to fill the file name with some default String, instead of just leaving them blank.
    Does anybody know how to do this?
    Many Thanks!

    look up the set...() methods of the JFileChooser api docs

Maybe you are looking for