Quote:
> I just read the MIND article about drag n drop via WSH, and it seems to me
> that this really should just be built in to WSH. By default, when you drop a
> file or files on a script icon, or shortcut, that script should be called,
> and the file list be present in a collection. Perhaps in the next version of
> WSH this will be the case? Or, has any intrepid third party already written
> this? I have a number of uses for this capability, but I don't know C++, so
> I cannot roll my own.
> Anyone have any thoughts?
I agree, wholeheartedly. I believe it is a truly absurd oversight on
MS's part.
The only work around I have been able to come up with is to wrap the
script in a batchfile and start the batch file via a shortcut (that
minimizes the command prompt session on the taskbar), something like
this ...
shift
wscript "C:\Scripts\test.vbs" %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
It requires the script's location to be hard coded into the batch
wrapper. A possible extension might be ...
set DaD=%1
:Loop
if not [%3]==[] set DaD=%Dad% %2
if not [%3]==[] for %%v in (shift goto:Loop) do %%v
if exist %2 wscript %2 %DaD%
This would allow the the script's name to be appended as an argument to
the batch procedure on the shortcut's 'Cmd line'. The procedure
collects if from the tail end of the drag and drop list of command line
arguments. Then one batch file could serve all script shortcuts. Note
that the command line is limited to no more than 256 characters in this
context, so the number of D&D arguments is severly limited. Clearly a
full directory of file names can not be passed in this manner, though
the directory name could be substituted as long as the script were
constructed to handle the distinction. Still, it sure seems silly to
need an anachronistic batch procedure to run a Win script.
Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/