How to set file filter default in Save dialog?
I am using the line below in a routine to save a file in comma-delimited format. I am using this command to append data to an existing .CSV file.
Save /A=2 /B /J /DLIM="," /I selWnames
I'd like to be able to just click on the existing file when the dialog appears. However, the dialog that appears with the command above has has the file filter at the bottom set as "Plain text:*.txt", so that the files available (which are all .CSV) are all greyed out. Therefore I need to use the mouse (no keyboard shortcut that I could find for this; MacOS) to change the file filter to "All files, "*.*", so that the CSV files become available to be selected.
Is there a flag that allows me to change the default of the Save dialog box to "All files"?
I tried adding the flags /T and /G but they do not affect the dialog box.
Or should I be using the Open command with the /F flag set to "All files:*.*;" instead?
Since you are appending, you will want to use an Open File dialog.
DisplayHelpTopic "Displaying an Open File Dialog"
Here is the DoOpenFileDialog from that help topic modified to use .csv:
Variable refNum
String message = "Select a file"
String outputPath
String fileFilters = "CSV Files (*.csv):.csv;"
fileFilters += "All Files:.*;"
Open /D /R /F=fileFilters /M=message refNum
outputPath = S_fileName
return outputPath // Will be empty if user canceled
End
Then
String fullPath = DoOpenFileDialog()
if (strlen(fullPath) == 0)
return -1 // User canceled
endif
Save /A=2 /B /J /DLIM="," selWnames as fullPath
return 0 // Success
End
September 9, 2023 at 08:28 pm - Permalink
I never thanked you for this, Howard. Thank you.
February 27, 2024 at 02:57 am - Permalink
You're welcome!
February 27, 2024 at 05:09 am - Permalink