UI.savepanel - can I specify BOTH default filename and file type?

 tl_file_name = UI.savepanel("Save Timber List", "","timber_list.xlsx")

and

 tl_file_name = UI.savepanel("Save Timber List", "","*.xlsx")

both work as expected, but I’d like to be able to set both. Both fields appear in the dialog box, so it seems there should be a way. In this case, it’s OK if it’s windows only (I’m using OLE to create the spreadsheet).

Nope. : :frowning:

Unfortunately this is still the situation:

1 Like

The only way (currently) is to use a timer block and stuff the suggested filename into the “File name:” field using the WSH SendKeys method …

require 'win32ole' unless defined?(WIN32OLE)
UI.start_timer(1.0,false) do
  WIN32OLE.new('WScript.Shell').SendKeys('timber_list.xlxs')
end
tl_file_name = UI.savepanel('Save Timber List', "",'Excel XML Workbook|*.xlsx')

And this is obviously MS Windows only.

Yeah, thanks anyway, Dan. I’ll live with *.xlsx.

Beware that the * will crash Mac on some older versions. (See docs.)