Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Drag and drop

Reply
Thread Tools

Drag and drop

 
 
Tino
Guest
Posts: n/a
 
      03-02-2005
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
lot_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


 
Reply With Quote
 
 
 
 
GreenLeaf
Guest
Posts: n/a
 
      03-03-2005
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
> lot_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.
 
Reply With Quote
 
 
 
 
Fabian Pilkowski
Guest
Posts: n/a
 
      03-03-2005
* 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
 
Reply With Quote
 
Tino
Guest
Posts: n/a
 
      03-07-2005

"Fabian Pilkowski" <(E-Mail Removed)-marburg.de> wrote in message
news:(E-Mail Removed) ...
>* 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"?


 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      03-07-2005
"Tino" <chamynpj@___brightonline.com.au> wrote in
news:d0hkre$pn9$(E-Mail Removed):
>
> "Fabian Pilkowski" <(E-Mail Removed)-marburg.de> wrote in
> message news:(E-Mail Removed) ...


....

>> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag and Drop and Generate Graphic backstreetboy Java 0 10-22-2007 08:29 AM
Drag and Drop Tree and Form Submit wreed Javascript 5 04-17-2007 03:19 PM
Q:How to "drag and drop" jpg's into html and have the code write itself? mr_cross HTML 11 10-11-2006 10:27 PM
RubyDotNet and Drag and Drop Wayne Vucenic Ruby 3 09-28-2003 09:01 PM
Drag & Drop API: get source component in drop traget 'dragOver' Oliver Klein Java 0 08-24-2003 12:01 PM



Advertisments