Processing drag & drop on the desktop

Larry Bates larry.bates at websafe.com
Mon Sep 17 17:08:30 CEST 2007


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



More information about the Python-list mailing list