Default file name in Save dialog

In our application, we need to specify a default name when
calling file.browseForSave("Save"). However, it seems impossible.
file.resolvePath("<path>") does not help as if the
specified path does not exist, it throws out an error.
Anyone can help? Thanks in advance!

Thank you for your reply. I did try that. However, the
problem is the similar to using file.resolvePath("<path>").
In var f:File = new File( "/path/to/yout/file.txt" ), if
"/path/to/yout/file.txt" is not an existing file on the disc, there
will be the following error:
ArgumentError: Error #2004: One of the parameters is invalid.
at Error$/throwError()
at flash.filesystem::File/set nativePath()
at flash.filesystem::File()
When saving data to a file, the file may not exist on the
disc...

Similar Messages

  • Need help adding a default file name in a file chooser of save dialog type

    I need to create a file chooser with save dialog type, how can I add a highlighted default file name into the File Name textfield? As in Microsoft Word, when you want to save a document, a default file name Doc1.doc will appear in the File name text field of the file chooser even when you change to other directories.

    For JRE 1.4.0 you can use this fix:
    public class FileChooserFix implements PropertyChangeListener {
      private String fileName;
       * @see PropertyChangeListener
      public void propertyChange(PropertyChangeEvent ev) {
        JFileChooser chooser = (JFileChooser)ev.getSource();
        if (JFileChooser.FILES_ONLY == chooser.getFileSelectionMode()) {
          if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(ev.getPropertyName())) {
            File selectedFile = (File)ev.getNewValue();
            if (selectedFile != null) {
              // remember fileName of selected file
              fileName = selectedFile.getName();
          if (fileName != null &&
              JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(ev.getPropertyName())) {
            // reset selected file
            File directory = (File)ev.getNewValue();
            chooser.setSelectedFile(new File(directory, fileName));
       * Convenience method to create a fixed file chooser.
       * @return      fixed file chooser
      public static JFileChooser create() {
        JFileChooser chooser = new JFileChooser();
        chooser.addPropertyChangeListener(new FileChooserFix());
        return chooser;

  • Excel 2010 missing default suggested file name in Save As dialog box

    I’m using Excel 2010 running on Windows 7 (32 bit).  When I open a certain file which produces the following message: "A file is in a different file format than its extension indicates", and then go to “Save As” (or “Save”) the
    file, the default suggested file name is missing (blank).  This didn't occur in previous versions of Excel. 
    In previous versions, Excel would automatically populate the original file name in to the File Name field.
      I have searched all over the net, looking for a way to change Excel so that it will once again populate the file name in this situation. 
    To reproduce:
    Create a new blank workbook
    save as type “Web Page”, (i.e. File name:  “Blank Example.html”)
    Close workbook
    In windows, rename file from .html to .xls  (i.e. rename “Blank Example.html” to “Blank Example.xls”)
    In Excel open renamed file (i.e. “Blank Example.xls”) and click “Yes” when prompted with the “A file is in a different file format than its extension indicates” message.
    Do a “Save As” and you will notice that the File Name is blank. In previous versions, this field would contain the current workbook file name
     (i.e. “Blank Example.xls”)
    Any help will be greatly appreciated.

    Hi Jaynet,
    In order to re-produce this, you need to answer "yes" to the rename file prompt and then continue with step 5 (above).
    The reason for this is not an exercise in futility - I assure you.  At my work and elsewhere, when web developers have created features to permit the end user to save web data in Excel format, often times the Excel files are saved locally in Excel's
    html format (but with the .xls
    extension). 
    (I actually prefer the .xls
    extension, because it is easier to just double-click the file to open in Excel, rather than to select the open-with and then select Excel. a file with the .html extension will default open in your default browser. Now, I could change my default program
    for the .html extension, but that would only solve a part of the problem and would not really address the bigger issue and that being that Microsoft changed a behavior in Excel and may not even be aware that it was a much used feature. )
    To continue, when I go to open the resulting Excel file, I am prompted with the message that the file type does not match the extension (which is fine and not bothersome to me).  It's at this point when I go to save the file that I get really annoyed.
    In previous versions of Excel, the default file name would be pre-filled with the current name of the file and the default file type would state that it is a Web html file.  I would just change the file type to Excel Workbook and hit enter to save.
    I would be prompted with "Are you sure you want to overwrite your existing file?" message and I would click "yes" and that would be that.
    However, in Excel 2010, because the default file name is blank, I then need to re-type the name into the field to save the file. 
    Any help is greatly appreciated.
    Thanks

  • SAVE AS script w/Default file name?

    I have created a SAVE AS button on my form however; the default file name is random characters in a temp folder path. How can I change the file name to automatically appear as one of my form field values?
    Ex: Someone presses the SAVE AS button and the dialog comes up with the default file name "FileNameField.pdf".
    I'm not as concerned about the path as I am about the file name. I also want to deploy this for to many people and don't want to install anything at each workstation in order for the script to work.
    It seems like it would be an easy script...but I can't find anything that's remotely 'easy' out there.
    The ultimate goal is to have the File Name = to one of my form fields called 'FileName".
    Thanks for any insight...
    -Joe

    This is only possible with a folder level script.
    You will have to install those script on your system.
    Details and samples can be found here:
    http://thelivecycle.blogspot.com/2009/11/save-form-to-specific-directories-and.html

  • AdobePDFViewer.plugin And Default File Name When Saving

    When I grab a PDF document from a web page, it opens in a Safari Window just fine, as expected. I get the Adobe Plug-in Tool Bar as expected. So now I want to File:Save As the document that I have grabbed and am now looking at in my Safari window. The File:Save As dialog opens and the document title always defaults to 'downloadDocument' instead of the actual name of the file that I have grabbed, even if the html has passed the true file name to the browser and plug in. This means I have to retype the name of the document before I click OK. What a pain......
    I cannot find a preference or other setting that would be controlling this. I've looked through the Safari Prefs and the Adobe Prefs
    I should note that I have Acrobat Pro 9.0.0 installed, and I'm running Safari 3.2.1 (5525.27.1) on an MBP 2.5GHz C2D with 4GB of RAM. OS X v10.5.6 totally current.
    How do I get the default file name in the File:Save As dialog to be the name of the file I have grabbed?

    Well, that results in the correct document name appearing in the Save As dialog.
    However, it also means all the Adobe tools are gone.
    And more importantly, it means that the in-document bookmarks are not available for use. The bookmarks are critical in our application. We work with very long documents (big insurance policies) that have many sections and hence they are all bookmarked so that we can move from section to section easily and find the specific sections, pages, endorsements, etc. that we need.
    So, it appears my next step is to "visit" Adobe and find out why they don't play nice??????

  • JFile chooser default file name setting

    Could anybody pls tell me how I can set a default file name when JFile chooser Save dialog box appears so that the user doesn't need to name the file to be saved. And I also want to get the name of a file from current selected directory so that I can warn user for the replacement, The code I tried with is as follows
    public void SaveAs()
                    String FileName="";
              JFileChooser jfc = new JFileChooser();
              int r = jfc.showSaveDialog(this);
              if (r== JFileChooser.APPROVE_OPTION)
                   FileName = jfc.getSelectedFile().getPath();
                   FileName=FileName+".java";
                   writeFile(FileName);
         }//End of SaveAs() Method
      public void writeFile(String fn)
               String contetnt="THIS IS A FILE";
              try{
                   FileWriter fw = new FileWriter(fn);
                   fw.write(contetnt);
                   fw.close();
              }catch(FileNotFoundException fnfe){}
               catch(IOException ioe){}
         }//End of writeFile(String fn) Method

    Works fine for me.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html
    Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
    http://forum.java.sun.com/help.jspa?sec=formatting

  • Dynamically populate pdf File name in 'Save As' dialogue box

    We have  rendered a pdf using adobe webservice.
    Once the pdf is generated , and we click on saveAs menu dialogue box opens and default name is populated in fileName field.
    Can it be possible to populate that name dynamically ? We tried using response.addheader() but it didnt work.
    Note : We are using java to create xml which we are passing to adobe webservice.

    Hi Jaynet,
    In order to re-produce this, you need to answer "yes" to the rename file prompt and then continue with step 5 (above).
    The reason for this is not an exercise in futility - I assure you.  At my work and elsewhere, when web developers have created features to permit the end user to save web data in Excel format, often times the Excel files are saved locally in Excel's
    html format (but with the .xls
    extension). 
    (I actually prefer the .xls
    extension, because it is easier to just double-click the file to open in Excel, rather than to select the open-with and then select Excel. a file with the .html extension will default open in your default browser. Now, I could change my default program
    for the .html extension, but that would only solve a part of the problem and would not really address the bigger issue and that being that Microsoft changed a behavior in Excel and may not even be aware that it was a much used feature. )
    To continue, when I go to open the resulting Excel file, I am prompted with the message that the file type does not match the extension (which is fine and not bothersome to me).  It's at this point when I go to save the file that I get really annoyed.
    In previous versions of Excel, the default file name would be pre-filled with the current name of the file and the default file type would state that it is a Web html file.  I would just change the file type to Excel Workbook and hit enter to save.
    I would be prompted with "Are you sure you want to overwrite your existing file?" message and I would click "yes" and that would be that.
    However, in Excel 2010, because the default file name is blank, I then need to re-type the name into the field to save the file. 
    Any help is greatly appreciated.
    Thanks

  • Default File name using CL_BDS_DOCUMENT_SET= CREATE_WITH_TABLE

    Hi folks,
    We are using BSP application to display smartform in PDF format in a new page/window. When I try to save the PDF from the browser/window, its pops up a screen with defaults as "Desktop" and a File Name. I am not sure how system is generating the default file name. How can we change this File Name?
    Thanks for help!
    Best Regards,
    Praveen

    Hi,
    It's done while creating the Response-Caching as in below code:
    cl_http_server=>server_cache_upload( url = filename   response = response ).
    We can pass custom value in the variable filename.
    Kind Regards,
    Praveen

  • Is it possible to propose another default file name in ALV Excel Export?

    Hello All,
    I have a problem while exporting to Excel from the WD ALV. The whole process works fine, the problem occurs when the user wants to open (without saving) multiple exported Excel documents at the same time. In this case he gets an error message, that the document with the same name has already been opened.
    Therefore I have a question, is it possible to customize default file name, so that instead of 'export.xlsx' the file name will contain e.g. WD title&time (or something like that)?
    Thank you very much in advance.

    Hi,
    It's the standard functionality. You actually have to enhance the standard method, which is not advisable as the same will be called in other applications as well.
    So, Instead of that, hide the standard Export functionality and create a new Tool bar button, say, 'Export to Excel' and in on action of that button, use cl_wd_runtime_services=>attach_file_to_response ( and pass the file name by concatenating date/time) method to open/save the file.
    Check this document to create a custom button in ALV tool bar: Creating Self-Defined Functions in WDA ALV
    And, check this blog by Chris for code reference to have Export to Excel functionality: Using WD ABAP ALV export - the hacked way
    Hope this helps u,
    Regards,
    Kiran

  • Changing the default file name while saving the PDF interactive form

    Hi All,
    I am generating an Interactive PDF form using webdynpro, but when I try to save the PDF to my local machine the default file name comes as "<b>unknown.pdf</b>" so I have to manually go and enter the name before saving it.
    Is there any way to change this default name so that I don't have to manually edit the file name each time when I want to save the generated PDF interactive form?
    Please reply soon.
    Thanks in advance!

    I am running into the same issue. Setting the desname parameter (e.g. desname=temp.pdf) doesn't have any effect. Has anyone found a solution to this?
    Thanks,
    Brian

  • Can i set a default file name with path when using IOpenFileDialog?

    At present, if i use
    IDFile xmlDataFile("C:\\a.txt");
    openFileDialog->DoDialog(&xmlDataFile, resultFiles, kFalse, &title);
    It use "C:\" as its default folder, but the file name box is empty, what i want is to show "a.txt" as its default file name.
    It looks like there is no such api to set a default in  IOpenFileDialog.
    Am i right?

    At present, if i use
    IDFile xmlDataFile("C:\\a.txt");
    openFileDialog->DoDialog(&xmlDataFile, resultFiles, kFalse, &title);
    It use "C:\" as its default folder, but the file name box is empty, what i want is to show "a.txt" as its default file name.
    It looks like there is no such api to set a default in  IOpenFileDialog.
    Am i right?

  • How to set selected file in FileChooser showSaveDialog to default file name

    Hi,
    How do I set selected file in JavaFX 2.0 FileChooser showSaveDialog, so I can prompt the user with a suggested default file name?
    I am converting a Java Swing application I wrote a few years ago to JavaFX 2.0.
    In the Swing application, I use setSelectedFile() as follows:
    JFileChooser jFileChooser = new JFileChooser();
    jFileChooser.setSelectedFile(new File(backupfile));
    jFileChooser.setCurrentDirectory(new File(outputDirectory));
    FileFilter filter = new FileNameExtensionFilter("Comma Delimited (*.csv)", "csv");
    jFileChooser.addChoosableFileFilter(filter);
    jFileChooser.setFileFilter(filter);
    filter = new FileNameExtensionFilter("XML Document (*.xml)", "xml");
    jFileChooser.addChoosableFileFilter(filter);
    jFileChooser.setAcceptAllFileFilterUsed(false);
    jFileChooser.setDialogTitle("Export File");
    int returnVal = jFileChooser.showDialog(jFrame, "Export");
    This would show a file chooser with the file name text field pre-populated with a default backup file name.
    I can't find an equivalent in JavaFX.
    Also, in the Swing application, I was able to determine which extension filter was selected at run time using getFileFilter().getDescription() as follows:
    String extension = jFileChooser.getFileFilter().getDescription();
    if (extension.equals("XML Document (*.xml)")) { ...
    I can't find an equivalent in JavaFX.
    Thanks,
    Barry

    You can use the open sequence file method on the application manager (then you only need to wire the file path)
    Rodéric L
    Certified LabVIEW Architect

  • How to set the default file name for upload

    Hi All,
    I have the following BSP app for a file upload of a csv file. I want the page when displayed show the default file name to be loaded as c:\db1\currentPM.csv
    What changes do I need to make to get the default file name in the BSP app.
    Thanks
    Karen
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content id               = "content"
                   design           = "classicdesign2002design2003"
                   controlRendering = "sap"
                   rtlAutoSwitch    = "true" >
      <htmlb:page title="File Upload " >
        <htmlb:form method       = "post"
                    encodingType = "multipart/form-data">
              <htmlb:textView text   = "File:"
                              design = "STANDARD" />
              <htmlb:fileUpload id          = "uploadID"
                                onUpload    = "UploadFile"
                                upload_text ="Upload"/>
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    On Input Processing
    event handler for checking and processing user input and
    for defining navigation
    DATA: EVENT TYPE REF TO IF_HTMLB_DATA,
          DATA TYPE REF TO CL_HTMLB_FILEUPLOAD,
          LV_OUTPUT_LENGTH TYPE I,
          LV_TEXT_BUFFER TYPE STRING,
          FILE_NAME TYPE STRING,
          FILE_PATH TYPE STRING ,
          INTERN TYPE TABLE OF  ZALSMEX_TABLINE.
    DATA: LT_BINARY_TAB TYPE TABLE OF SDOKCNTBIN .
    TYPES: BEGIN OF TY_TAB,
           FIELD1(2) TYPE C,
           FIELD2(2) TYPE C,
           FIELD3(2) TYPE C,
           FIELD4(2) TYPE C,
           FIELD5(2) TYPE C,
           END OF TY_TAB.
    DATA:  WA_TAB TYPE TY_TAB,
           IT_TAB TYPE TABLE OF TY_TAB.
    TYPES: BEGIN OF TY_LINE,
              LINE(255) TYPE C,
           END OF TY_LINE.
    DATA:  WA_LINE TYPE TY_LINE,
           IT_LINE TYPE TABLE OF TY_LINE.
    EVENT = CL_HTMLB_MANAGER=>GET_EVENT_EX( REQUEST ).
    IF EVENT IS NOT INITIAL AND EVENT->EVENT_NAME = HTMLB_EVENTS=>FILEUPLOAD.
      DATA ?= CL_HTMLB_MANAGER=>GET_DATA( REQUEST = RUNTIME->SERVER->REQUEST NAME = 'fileUpload' ID = 'uploadID' ).
      FILE_NAME = DATA->FILE_NAME.
      FILE_PATH = FILE_NAME.
      IF DATA IS NOT INITIAL.
        CALL FUNCTION'SCMS_XSTRING_TO_BINARY'
         EXPORTING BUFFER = DATA->FILE_CONTENT
         IMPORTING OUTPUT_LENGTH = LV_OUTPUT_LENGTH
         TABLES BINARY_TAB = LT_BINARY_TAB .
        CALL FUNCTION'SCMS_BINARY_TO_STRING'
        EXPORTING INPUT_LENGTH = LV_OUTPUT_LENGTH
         IMPORTING TEXT_BUFFER = LV_TEXT_BUFFER
         TABLES
         BINARY_TAB = LT_BINARY_TAB.
        IF SY-SUBRC = 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        SPLIT LV_TEXT_BUFFER AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE IT_LINE.
        IF SY-SUBRC = 0.
          LOOP AT IT_LINE INTO WA_LINE.
           SPLIT WA_LINE AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
            split wa_line at ','
            INTO WA_TAB-FIELD1 WA_TAB-FIELD2 WA_TAB-FIELD3 WA_TAB-FIELD4 WA_TAB-FIELD5.
            append wa_tab to it_tab.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDIF.

    Also, I missed another point.
    In the folder c:\dbdata I have a number of CSV files on the user frontend. I would like the BSP application to get the list of files in the folder and process them one after the other. How can I get the list of files on the folder in the user PC and how to process them one after the other.
    I want the form to display only the default folder and once I press on upload it must process all files and display the status of processing on the same page.
    Please kindly share ideas how I can implement this app.
    Thanks
    Karen

  • Is there a way to change the export default file name

    I have a request to change the default file name when doing a pdf export of a report. By deault, when pushing the export to pdf button, the name is NONAME.pdf. They want the default name to be the channel name is displayed on the report.
    Is there an easy way to do this, or will I have to load all new code into the export button?

    What you'll probably want to do is create a script that uses the Call Report.Sheets.ExportToPDF function and programatically specify the name.  From here, you could set it as one of the function buttons or even include it on the toolbar if you'd like.
    Jesse S.
    Applications Engineer
    National Instruments

  • Change File Name on Save

    Hi all,
    I have an action recorded that helps me to resize and rename an original image several times.  The action works perfectly, but I have to have the save step as manual so I can enter the correct save name for each file after the action resizes the image.  The save process is idential each time so I figure you must be able to 100% automate this.  So here is the scenario - hope someone can help.
    I have a heap of files open in Photoshop CS3
    action - resize and save as (current action does this)
    delete last 4 characters of current file name and add '1500' to end of current file name and save (this is what I want to automate)
    action - resize and save as (current action does this)
    delete last 4 characters of current file name and add '400' to end of current file name and save (this is what I want to automate)
    action - resize and save as (current action does this)
    delete last 3 characters of current file name and add '200' to end of current file name and save (this is what I want to automate)
    action - resize and save as (current action does this)
    delete last 4 characters of current file name and add '100' to end of current file name and save and close file (this is what I want to automate)
    run action again for all open files (this is what I want to automate)
    thanks in anticipation!   BD

    Here's a script for you:
    var count = 4;           // number of characters to remove
    var appendStr = '1500';  // string to append
    function main() {
      if (app.documents.length == 0) {
        return;
      var doc = app.activeDocument;
      var nm = doc.name;
      var base = nm;
      var ext = '';
      var m = nm.match(/(.*)(\.[^\.]+)/);
      if (m) {
        base = m[1];
        ext = m[2];
      if (base.length > count) {
        base = base.substring(0, base.length - count);
      var newName = base + appendStr + ext;
      doc.duplicate(newName);
    main();
    Save this to a file called "1500Dupe.jsx" or whatever.
    At the end of your first action, call this script. It will create a duplicate of the current document with last 4 characters replaced with '1500'.
    You will also need additional step in the action to save this to a file and close the duplicate document. It's simpler to do this in the action than it is in the script.
    You will need to create new jsx files for each of the other substitutions that you want to make. Just change the 'count' and 'appendStr' values as needed and save to new files.
    -X

Maybe you are looking for

  • Can't access any photos, Camera Roll sends me to home screen?

    Yesterday I took over 100 photos on my phone for work.  After returning to the office and attempting to sync them to the cloud the process froze and never completed. Afterward I am unable to view any of the photos in the Camera Roll.  Each time I cli

  • XSLT Mapping and Graphical Message Mapping

    Hi, Can any one let me which is advatageous and why or let me know where I can find docs. Thanks In Advance. Yaseen

  • Help with simple PL/SQL package

    Hi, I'm trying to create a simple PL/SQL package to loop over a list of names and do some fuzzy pattern matching to attempt to clean up the data. Unfortunately..I don't know anything about PL/SQL, and hitting problems getting this to work. Could some

  • Why is it taking like 2-3 mins for just one song to go onto my iPod?

    I thought my iPod was fixed completely last night, when I was on the phone with apple for 2 hours. My iPod was "corrupted", it wouldn't open in my iTunes and it kept freezing it. We tried changing the disk letter, blah blah. We finally solved the pro

  • Calculating VIRTUAL_TABLE_PAGE_SIZE

    Hello, How do we calculate the optimum VIRTUAL_TABLE_PAGE_SIZE for OBIEE. By default this value is set to 128 kb. Will icnreasing it increase the performance ? VIRTUAL_TABLE_PAGE_SIZE: specifies the size of a memory page for OBI internal processing T