Open native Save As... panel

#1

Hi,

I’m working on an extension that recreates the native Save command, except that it checks what version the file was previously saved to, if saved, and save to the same version.

I’ve gotten the whole read existing file version part, as well as saving to it, to work. However, I’m struggling to open the native Save dialog. If the model has never been saved I want the extension to open the native Save dialog, to be fully consistent to native Save. Ideally the user should be able to re-target Ctrl+S to trigger the extension, and still having it functioning properly.

Sketchup.send_action(21036) doesn’t appear to work in any SU version, despite what the documentation says.

Is it possible to make a platform dependent hack that simulates Ctrl/Command+S? If so the user won’t be able to use that shortcut for the extension, but it’s still a possible solution I’m considering. Are there any other ways to trigger this command?

#2
Sketchup.send_action('saveDocument:')  ## Save  ### ⌘S

Sketchup.send_action('saveDocumentAs:')  ## Save As...  ### ⇧⌘S

john

2 Likes
#3

saveDocumentAs strangely doesn’t seem to work on Windows, but saveDocumentis exactly what I needed, and works!