Save As script for project class or otherwise

Hey everyone!

I am using a scripted save button I grabbed from some example that uses this function to save:

save(path, saveExternalToxs=False)→ bool:

#Save the current session to disk. Returns True if a file was saved, False otherwise (eg, if the #file exists, and when prompted, the user selects to not overwrite).

#path - (Optional) If not provided the default/current filename is incremented and used. The #current file is project.name under folder project.folder.

project.save()

What is the best method for changing this to a “Save As” type of functionality?

Use case is a canvas system media server that I want to have a perform mode button for saving show files with relevant names instead of just numbered file increments.

Other than creating a text input object in touch and feeding that into the save() command path attribute, is there a way to do it with the standard windows explorer shell function for save as popping up?

B

You can use the ui.chooseFile method to get a filename/path.

f = ui.chooseFile(load=False, start=None, fileTypes=['.toe'], title=None, asExpression=False) project.save(f)

Similarly, to load a file:

f = ui.chooseFile(load=True, start=None, fileTypes=['.toe'], title=None, asExpression=False) project.load(f)

The ui class has quite a few handy methods you might find useful.

[url]https://www.derivative.ca/wiki099/index.php?title=UI_Class[/url]