Python Script vs. Win32 SendTo

John A. Grant zjagrantz at znrcanz.gcz.ca
Sat May 13 01:00:50 EDT 2000


"Tom Vrankar" <no at spam.net> wrote in message
news:4_4T4.1115$Xl.103670 at news.goodnet.com...
> I'm trying to write a python script that I want to place in Win32's SendTo
> directory. I'm completely confused. I can drop shortcuts to various .exe
files
> in there, and they do what I want. But a .py script... I got nuthin'.
>
> I tried to edit the target of the shortcut to insert "python" (it's in my
> PATH), but that seemed to just run python on the file I sent to the
shortcut,
> not the script referenced by the shortcut. I tried to define a new
filetype
> with an extention of .sendto, with an Open action that would run the
command
> line 'python script.py "%1"', but got same result.
>
> I can approximate what I want by creating a batch file, and dropping it's
> shortcut in SendTo. I've editted the PIF to close on exit and run
minimized,
> but it's unsightly, and slow, and DOS-ifies the paths of the files I send
to
> it.
>
> Anyone have any suggestions for the "correct" way to write a sendto-able
> script in python? Thanks for any ideas.

    "Send to" is no different than double-clicking the file. It
    launches the indicated application and delivers the file
    to it on the command-line.  It's also the same as dropping
    the file onto a shortcut to the application.

    But even though the shell can ShellExecute a .doc file
    and it can also ShellExecute() a .txt file, it really doesn't
    know what to do if you drop a .txt file onto a shortcut to
    a .doc file, does it?  What should it do - launch the .doc
    app or the .txt app?  What file should be displayed - the
    .txt file or the .doc file? So you can't send a file to a
    shortcut to another file, only to a shortcut to an app.

    You said you tried:
        "python script.py %1"

    but it didn't work. It's possible that python only processes
    argv[1] and ignores argv[2]. Try it from the command-line
    and see if it does or not.

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here






More information about the Python-list mailing list