Drag and drop

Discussion in 'Perl Misc' started by Tino, Mar 2, 2005.

  1. Tino

    Tino Guest

    I would like to be able to drag and drop files onto a .pl file in the same
    way I can drop files onto a .bat file. I made a .bat which can do this but
    if I try to do the same thing with a .pl file I find the .pl file isn't able
    to accept files for drag and drop operations, the cursor changes to the "not
    allowed operation" symbol when the file being dropped is over the .pl file.
    What do I have to do to the .pl file to make it work like the .bat file?

    Example of .bat file onto which a file can be dropped:

    @echo off
    :plot_loop
    print.pl p=1 %1
    shift
    if not "%1"=="" goto plot_loop


    Example of .pl file that I would like to do the same as the .bat file:

    use strict;
    use warnings;

    foreach (@ARGV) {
    system("print.pl p=1 $_");
    }


    regards

    Peter
     
    Tino, Mar 2, 2005
    #1
    1. Advertising

  2. Tino

    GreenLeaf Guest

    Tino wrote:
    > I would like to be able to drag and drop files onto a .pl file in the same
    > way I can drop files onto a .bat file. I made a .bat which can do this but
    > if I try to do the same thing with a .pl file I find the .pl file isn't able
    > to accept files for drag and drop operations, the cursor changes to the "not
    > allowed operation" symbol when the file being dropped is over the .pl file.
    > What do I have to do to the .pl file to make it work like the .bat file?
    >
    > Example of .bat file onto which a file can be dropped:
    >
    > @echo off
    > :plot_loop
    > print.pl p=1 %1
    > shift
    > if not "%1"=="" goto plot_loop
    >
    >
    > Example of .pl file that I would like to do the same as the .bat file:
    >
    > use strict;
    > use warnings;
    >
    > foreach (@ARGV) {
    > system("print.pl p=1 $_");
    > }
    >
    >


    Not the exact answer to your question; but if you just need to _get the
    job done_, two alternatives are

    1. use the following one-liner batch file that calls the perl script in
    turn.

    @perl "path\to\script\thescript.pl" %*

    2. consider compiling the perl script in to a Windows executable.
     
    GreenLeaf, Mar 3, 2005
    #2
    1. Advertising

  3. * Tino wrote:
    >
    > I would like to be able to drag and drop files onto a .pl file in the same
    > way I can drop files onto a .bat file. I made a .bat which can do this but
    > if I try to do the same thing with a .pl file I find the .pl file isn't able
    > to accept files for drag and drop operations, the cursor changes to the "not
    > allowed operation" symbol when the file being dropped is over the .pl file.
    > What do I have to do to the .pl file to make it work like the .bat file?


    If you've a version of ActiveState's Perl installed have a look into its
    bin-directory. You will find a small tool named "pl2bat.bat" which wrap
    your perl code into a batch file.

    Otherwise you can add a new key to your windows registry to imitate the
    behavior of batch files. Then you can drag and drop your files directly
    to you perl script. Just create the key

    HKEY_CLASSES_ROOT\Perl\shellex\DropHandler\

    with default value set to "{86C86720-42A0-1069-A2E8-08002B30309D}".
    Don't ask something about this CLSID, for me this works on a german
    winxp machine. Perhaps you wanna compare this with your own system
    settings. I've copied this value from

    HKEY_CLASSES_ROOT\batfile\shellex\DropHandler\

    regards,
    fabian
     
    Fabian Pilkowski, Mar 3, 2005
    #3
  4. Tino

    Tino Guest

    "Fabian Pilkowski" <-marburg.de> wrote in message
    news:...
    >* Tino wrote:
    >>
    >> I would like to be able to drag and drop files onto a .pl file in the
    >> same
    >> way I can drop files onto a .bat file. I made a .bat which can do this
    >> but
    >> if I try to do the same thing with a .pl file I find the .pl file isn't
    >> able
    >> to accept files for drag and drop operations, the cursor changes to the
    >> "not
    >> allowed operation" symbol when the file being dropped is over the .pl
    >> file.
    >> What do I have to do to the .pl file to make it work like the .bat file?

    >
    > If you've a version of ActiveState's Perl installed have a look into its
    > bin-directory. You will find a small tool named "pl2bat.bat" which wrap
    > your perl code into a batch file.
    >
    > Otherwise you can add a new key to your windows registry to imitate the
    > behavior of batch files. Then you can drag and drop your files directly
    > to you perl script. Just create the key
    >
    > HKEY_CLASSES_ROOT\Perl\shellex\DropHandler\
    >
    > with default value set to "{86C86720-42A0-1069-A2E8-08002B30309D}".
    > Don't ask something about this CLSID, for me this works on a german
    > winxp machine. Perhaps you wanna compare this with your own system
    > settings. I've copied this value from
    >
    > HKEY_CLASSES_ROOT\batfile\shellex\DropHandler\
    >
    > regards,
    > fabian


    Thanks. I tried both options and they both work so I will go with drag and
    drop directly onto the Perl script. As per your example I used the
    DropHandler value from "batfile". I wonder if there is a more appropriate
    value for "Perl"?
     
    Tino, Mar 7, 2005
    #4
  5. "Tino" <chamynpj@___brightonline.com.au> wrote in
    news:d0hkre$pn9$:
    >
    > "Fabian Pilkowski" <-marburg.de> wrote in
    > message news:...


    ....

    >> Otherwise you can add a new key to your windows registry to imitate
    >> the behavior of batch files. Then you can drag and drop your files
    >> directly to you perl script. Just create the key
    >>
    >> HKEY_CLASSES_ROOT\Perl\shellex\DropHandler\
    >>
    >> with default value set to "{86C86720-42A0-1069-A2E8-08002B30309D}".


    ....

    > Thanks. I tried both options and they both work so I will go with drag
    > and drop directly onto the Perl script. As per your example I used the
    > DropHandler value from "batfile". I wonder if there is a more
    > appropriate value for "Perl"?


    No. That is the excutable drag & drop handler. A quick look through the
    registry would have shown you that that value is the same for exe, pif etc
    files as well.

    Sinan
     
    A. Sinan Unur, Mar 7, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oliver Klein
    Replies:
    0
    Views:
    725
    Oliver Klein
    Aug 24, 2003
  2. mr_cross
    Replies:
    11
    Views:
    634
    dorayme
    Oct 11, 2006
  3. backstreetboy

    Drag and Drop and Generate Graphic

    backstreetboy, Oct 22, 2007, in forum: Java
    Replies:
    0
    Views:
    304
    backstreetboy
    Oct 22, 2007
  4. Wayne Vucenic

    RubyDotNet and Drag and Drop

    Wayne Vucenic, Sep 28, 2003, in forum: Ruby
    Replies:
    3
    Views:
    175
    Wayne Vucenic
    Sep 28, 2003
  5. wreed

    Drag and Drop Tree and Form Submit

    wreed, Apr 11, 2007, in forum: Javascript
    Replies:
    5
    Views:
    379
    wreed
    Apr 17, 2007
Loading...

Share This Page