Reputation: 4827
Is there a way to execute saveDialog, silently , meaning, not asking the user to specify file name?
Its intended for existing code automation. lets assume we cannot use different saveDialog Object.
Upvotes: 0
Views: 447
Reputation: 43649
Well, the only purpose the SaveDialog has is providing a file name, so the obvious short anser is: do not use the SaveDialog.
But if you want to take all the options of the SaveDialog into account, then you have to do some checking yourself before saving the file. The non-visual options that apply, and the key routines that are involved for handling those options are:
ofPathMustExist
: if False, then use ForceDirectories
ofFileMustExist
: if True, then use FileExists
ofNoReadOnlyReturn
: if True, then use FileIsReadOnly
ofNoDereferenceLinks
: use it, inverted, as the FollowLink parameter in FileExists.All other applicable options (ofOverwritePrompt
= True, ofPathMustExist
= True, ofNoTestFileCreate
= False) are matched by using a try - except block around the saving of the file.
Upvotes: 6