How to make my_script drag and drop executable - Microsoft Windows

This is a discussion on How to make my_script drag and drop executable - Microsoft Windows ; I wrote a python script which executes in command line like ] my_scrpt I'd like to drag'n'drop the file into my script and get the output file, but drag'n'drop won't work for *.py files. How do I make *.py files ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: How to make my_script drag and drop executable

  1. How to make my_script drag and drop executable



    I wrote a python script which executes in command line like

    ] my_scrpt

    I'd like to drag'n'drop the file into my script and get the output file,
    but drag'n'drop won't work for *.py files. How do I make *.py files
    dragNdrop compatible?

    my guess says it's registry edit, but where, and how?

    Thanks in advance.

    --
    Daemon YOON



  2. Re: How to make my_script drag and drop executable

    Hi Daewon,

    I had a look at this:

    http://mail.python.org/pipermail/pyt...st/000481.html

    which led me to poke around a bit. Based on about 10 minutes of
    testing, this seems to work as expected.

    I made a file, python-drop-handlers.reg, which contains:



    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\Python.NoConFile\ShellEx\DropHan dler]
    @="{60254CA5-953B-11CF-8C96-00AA00B8708C}"

    [HKEY_CLASSES_ROOT\Python.File\ShellEx\DropHandler]
    @="{60254CA5-953B-11CF-8C96-00AA00B8708C}"



    It works immediately without reboot, with a plus sign on the icon being
    dropped to let you know it's working. The dropped file is picked up by
    sys.argv, so it seems to be functioning properly. The serial number
    points to the windows script host.

    Of course, I just made these up based on information plucked from
    google, so it's at your own risk, back up your registry, etc. I don't
    really know much about the inner workings of windows, so no promises.
    That said, it seems to work, and I don't imagine it could do any
    irreparable harm.

    Oddly, on my installation the .pys extention already has the drop
    handler registered, as detailed in the link above, but doesn't work
    because it isn't associated with a python executable, so you might try
    just renaming your script .pys and associating the extention with
    python. Again, I'm not a windows nor a python guru.

    Hope this helps,
    Hunwalla


+ Reply to Thread