0

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.

none
  • 4,669
  • 14
  • 62
  • 102
  • 2
    What should the result of that _execution_ be then? What purpose is left? – NGLN Aug 07 '11 at 11:55
  • 1
    hmm , interesting. i can prevent the execution of show dialog, and that will solve the problem. thank. make it an answer and ill mark it. With macro it can be done. – none Aug 07 '11 at 12:45

1 Answers1

6

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.

NGLN
  • 43,011
  • 8
  • 105
  • 200