vitoco has asked for the wisdom of the Perl Monks concerning the following question:
Hi!
I want a running perl script to process every dropped file dragged from Explorer, but I don't know how drag&drop work in Windows.
I wrote this simple script as test.pl to get an idea of what is happening when it is running in its own window after a double click:
#!perl use strict; use warnings; while (<>) { print $_; }
The result is that if I drag one file to the Strawberry perl window, I can see the file's full path, but I have to press the Enter key with the focus in that window to make the script get the file, i.e. to print back the path. This means that only the file path name is sent to the script, without a newline.
What if I drag multiple files to the perl window? Only one filename is received, and no newline...
Is there a module or exteral tool that I could use in order to receive dropped files to the running window? Is adding the handler to the registry in order to run the script by dropping files to its icon the only way?
Thanks!!!
Edit: I first tried a oneliner in CMD with the same result.
perl -pe ""
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to process dropped files
by Anonymous Monk on May 26, 2024 at 11:06 UTC | |
by vitoco (Hermit) on May 28, 2024 at 13:18 UTC | |
by bliako (Abbot) on May 29, 2024 at 07:07 UTC | |
by vitoco (Hermit) on May 27, 2024 at 03:49 UTC | |
|
Re: How to process dropped files
by bliako (Abbot) on May 26, 2024 at 12:34 UTC | |
by vitoco (Hermit) on May 27, 2024 at 03:53 UTC | |
|
Re: How to process dropped files
by The_Dj (Scribe) on May 28, 2024 at 06:43 UTC | |
by vitoco (Hermit) on May 28, 2024 at 13:27 UTC |