[slightly OT] Windows resources/docs

Alex Martelli aleax at aleax.it
Mon Jan 21 15:28:04 CET 2002


"Graham Ashton" <graham at effectif.idps.co.uk> wrote in message
news:mailman.1011612270.18786.python-list at python.org...
> I'd like to be able to control parts of Windows from Python, but don't
> know where to look to find out about possible interfaces. In short, I've
> got a problem finding the right docs.

Microsoft's MSDN site is generally where you end up (their MSDN CD's
or DVD's are basically equivalent, of course) in most (not all) cases.


> What I actually want to do is to empty the Windows Recycle Bin from
> Python. I imagine there is a nice neat way of doing it via COM, or
> similar, but don't know where to start reading. I don't even know if COM
> is the best approach here. Is there a better solution?
>
> If it is, how would I go about finding out what the API is for accessing
> things like the Recycle Bin from Python?

I go to  www.google.com  and enter in the textbox:

    "empty recycle bin"

including the quotes, then Enter.  I'm presented with the first 20
hits of about 5300.  Hit number four looks like it has to do with
_programming_, as it mentions "VBnet" system, so I exploratorily
open it.  There I see mentioned a promising item, an API called
SHEmptyRecycleBin.  Back to Google, and enter in the textbox:

    SHEmptyRecycleBin Python

4 hits, and number one is about ActivePython, specifically (long url):
http://aspn.activestate.com/ASPN/Python/Reference/Products/ActivePython/win3
2com/shell__SHEmptyRecycleBin_meth.html

Here, I see SHEmptyRecycleBin mentioned as a method of object shell,
a module of win32com.  Trying on interactive Python
    import win32com.shell
appears to give me an empty object, so it's back to google again
looking for
    win32com.shell
and the first hit (again, long url):
http://aspn.activestate.com/ASPN/Python/Reference/Products/ActivePython/win3
2com/win32com.shell_and_Windows_Shell_Links.html

shows me the usage is
    from win32com.shell import shell

I try that, it works as documented, end of search.

This time for search and experimentation (5-10 minutes depending on
how good is your net connection) is reasonably typical for tasks you
have never explored before; of course with time you build up a base
of "bookmarks" and knowledge which helps you cut the time.  Alas,
sometimes one hits a brickwall -- and that's when one asks on the
suitable newsgroups or mailing lists:-).


Alex






More information about the Python-list mailing list