daiku
April 9, 2024, 2:02pm
1
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).
dezmo
April 9, 2024, 3:35pm
2
Nope. :
Unfortunately this is still the situation:
opened 09:24AM - 05 Apr 18 UTC
enhancement
Ruby API
SketchUp
logged
ui
### Ruby API
Currently, in [`UI.openpanel`](http://ruby.sketchup.com/UI.html#… openpanel-class_method) and [`UI.savepanel`](http://ruby.sketchup.com/UI.html#savepanel-class_method), we can either set a default file name, or a list of possible file extensions. But we cannot set both at the same time.
It would be very useful to enable this possibility.
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.
daiku
April 9, 2024, 6:57pm
4
Yeah, thanks anyway, Dan. I’ll live with *.xlsx.
Beware that the * will crash Mac on some older versions. (See docs.)