How to get the user name, and to show a select directory dialog?
Mark Hammond
mhammond at skippinet.com.au
Sun May 25 19:13:37 EDT 2003
Arnal wrote:
> Hi!
>
> I would like to obtain the name of the current logged user on a Windows
> machine, so I can get the "My documents" and "Desktop" folders.
>
> I want to allow the user to specify the initial directory of the save
> command, and the open command. The "My documents" would be somehow basic to
> acceess, but I must have the username in the path (or can I access this
> folder directly with a function?). Or how to access the user name, else?
See the other responses.
> I would like, as well, to show a "select directory dialog". I can already
> put a select file and put file; I think that selecting a directory must be
> in the same module, isn't it?
from win32com.shell import shell
shell.SHBrowseForFolder()
(you may like to check out the docs and supply some of the args)
Mark.
More information about the Python-list
mailing list