Processing drag & drop on the desktop

Pierre Quentel quentel.pierre at wanadoo.fr
Wed Sep 19 08:02:29 CEST 2007


On 17 sep, 17:08, Larry Bates <larry.ba... at websafe.com> wrote:
> Pierre Quentel wrote:
> > Hi all,
>
> > I would like to create an application on a Windows machine, such that
> > when a document is dragged and dropped on the application icon on the
> > desktop, the document is processed by the application
>
> > For instance, if I drag & drop an Outlook message or a PPT
> > presentation, the application would propose to tag the document with
> > keywords taken from a database
>
> > Is it possible to do this with a Python script, and how ?
>
> > Regards,
> > Pierre
>
> If you write a python application and put a shortcut on the desktop, when you
> drop any file on it in Windows it is passed into the program via the sys.argv
> list as the second (e.g. sys.argv[1]) argument.  If you drop multiple files,
> they are passed in sys.argv[1] sys.argv[n].  All you need to do is to pick up
> the filename and do your processing.
>
> -Larry- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -

Thanks for the answers, but it still doesn't work

I tried to do this : create a Python script with
================
import sys
out = open("dummy","wb")
out.write(str(sys.argv))
out.close()
===============

then put a shortcut to this script on the desktop

When I drop a file on the shortcut, nothing happens (when I double-
click on the shorcut, a console window opens and sys.argv is actually
stored in the file)

Am I missing something ?

Regards,
Pierre




More information about the Python-list mailing list