Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TorgoX (1933)


"Il est beau comme la retractilité des serres des oiseaux rapaces [...] et surtout, comme la rencontre fortuite sur une table de dissection d'une machine à coudre et d'un parapluie !" -- Lautréamont

Journal of TorgoX (1933)

Monday September 09, 2002
07:14 PM

MSWindows "Send To" menu

[ #7641 ]
Dear Log,

So in MSWindows, there's a little "Send to" submenu you get when you right-click a file or directory icon. You can add items to that list by putting executables (usually shortcuts to exes or bats) in \windows\SendTo (altho that's a normally hidden directory, I think). So if you add a shortcut to Foo.exe or Foo.bat in that directory, and you right-click on juju.dat and select "Send To", a submenu with "Foo" appears. Click that "Foo", and the system will execute "Foo.exe juju.dat" (or "Foo.bat juju.dat" or whatever).

So in there, I have a shortcut to, and a bunch of other handy programs and batch files that call Perl programs.

But there's a problem: for some incomprehensible reason, some versions of MSWindows (including mine) pass the filename as the "short" filename. So working on juju.dat will call "Foo.exe juju.dat", but if it's a long filename like "useragent.patch", the command line will be "Foo.exe USERAG~1.PAT". That's fine, because most programs seem to turn the shortname into the longname. But some don't -- so when I select "Send To: CoolEdit", I get CoolEdit opening files by their shortname -- things like "NAVAJO~4.MP3" instead of something helpful like "Navajo_fricative_352.mp3".

So ActiveState perl comes to the rescue, via this two-line .BAT file:

@echo off
perl -e "exec 'C:\Program Files\Cool2000\cool2000.exe', chr(34).Win32::GetLongPathName(scalar Win32::GetFullPathName($ARGV[0])).chr(34)" %1

I just put that batch file wherever, then put a shortcut to it in the SendTo directory (and also then set the shortcut attributes to things like: start always an minimized, close on exit, etc).

Similarly, when I want to open an RTF file in wordpad instead of in the much more bloated MSWord, I open it via:

@echo off
perl -e "exec 'write.exe', chr(34).Win32::GetLongPathName(scalar Win32::GetFullPathName($ARGV[0])).chr(34)" %1

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.