Drag and Drop program launch on Windows

I want to be able to drag and drop a txt file onto my ruby program,
such that I get the full file path to the txt file in ARGV[0].

I found a page that showed me how to:
a) Create a .bat file with "ruby myprog.rb %1"
b) Create a shortcut to the .bat file with a hardcoded working
directory

But I need to be able to move this .bat/.rb file around and have the
working directory properly updated. (There are support files adjacent
to the .rb that I need to read in.)

Surely there's a better way. Some registry hack to make .rb files
drag-and-drop targets by themselves?

Well, here's a better way. Still not ideal (where ideal would be
dropping directly onto the .rb itself), but it'll do for now:

D:\<snip>\BindingDocumentation>type MakeDocumentation.bat
pushd %~dp0
ruby MakeDocumentation.rb %1
popd

That will change the working directory to the directory the .bat file
is in, and run the ruby command and pass in the path to the file
dropped on the bat file.

Hi,

At Fri, 16 Sep 2005 04:51:34 +0900,
Phrogz wrote in [ruby-talk:156330]:

Surely there's a better way. Some registry hack to make .rb files
drag-and-drop targets by themselves?

It needs to install a drag-and-drop handler. I often use "Drop
on Script".

  http://homepage3.nifty.com/yamakox/Others/DropOnScript.html
  (Japanese page only)

···

--
Nobu Nakada

Phrogz wrote:

I want to be able to drag and drop a txt file onto my ruby program,
such that I get the full file path to the txt file in ARGV[0].

I found a page that showed me how to:
a) Create a .bat file with "ruby myprog.rb %1"
b) Create a shortcut to the .bat file with a hardcoded working
directory

You could just put the shortcut in the "Send To" directory. Then it's
just a right-click and send to your script.

1) Download rubyscript2exe-0.4.0.rb from sourceforge..

2) test ruby script:
# -----test.rb-----
puts ARGV[0]
# -----/test.rb-----

3) run rubyscript2exe-0.4.0.rb test.rb
4) drag a file on the created test.exe

--Alternately, just make an rb script that waits on "gets", then
simply drag the file into the command prompt and hit enter..

dunno.. just some thoughts..

···

On 9/15/05, Alan Chen <Digikata@gmail.com> wrote:

Phrogz wrote:
> I want to be able to drag and drop a txt file onto my ruby program,
> such that I get the full file path to the txt file in ARGV[0].
>
> I found a page that showed me how to:
> a) Create a .bat file with "ruby myprog.rb %1"
> b) Create a shortcut to the .bat file with a hardcoded working
> directory

You could just put the shortcut in the "Send To" directory. Then it's
just a right-click and send to your script.