Processing drag & drop on the desktop

P

Pierre Quentel

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
 
T

Thomas Jollans

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 ?

Maybe the file name is passed as a command-line argument ?
 
S

Steve Holden

Thomas said:
Maybe the file name is passed as a command-line argument ?
This may give you some information that help, but it's not file-based.
You should be able to at least use it to explore the interface to
Windows Explorer, though:

http://fraca7.free.fr/blog/index.php?2006/11/15/53-thunderbird-drag-and-drop-with-wxpython

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline
 
L

Larry Bates

Pierre said:
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
 
P

Pierre Quentel

Pierre said:
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
 
G

Gabriel Genellina

En Wed, 19 Sep 2007 03:02:29 -0300, Pierre Quentel
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 ?

The shortcut must point to a *program*, not a *document*.
Change the "shortcut destination" to point to:
c:\path\to\python c:\path\to\your\script.py
 
P

Pierre Quentel

The shortcut must point to a *program*, not a *document*.
Change the "shortcut destination" to point to:
c:\path\to\python c:\path\to\your\script.py

Thanks for the explanation Gabriel, it works fine now
Pierre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top