From: "Hal E. Fulton" Date: 2003-07-08T00:05:09+09:00 Subject: Re: How to create Shell Links on Windows? ----- Original Message ----- From: "Chris Morris" To: "ruby-talk ML" Sent: Monday, July 07, 2003 9:12 AM Subject: Re: How to create Shell Links on Windows? > > Is there an easy way to create or modify shell links (.lnk) with ruby on > > windows? I know how to do that in C/C++ or Delphi, and I know that there > > is a scripting object named ShellLinkObject.Application that could be > > used by scripting languages (=>ruby, via the winole module), but > > unfortunately it is only available on Win2000 or XP because these have a > > newer version of the windows shell (5.00 as opposed to 4.71). > > The following depends on the Windows Scripting Host to be installed, but > this should exist on most systems by now: > > def create_shortcut(targetFileName, linkName) > shell = WIN32OLE.new("WScript.Shell") > scut = shell.CreateShortcut(linkName + '.lnk') > scut.TargetPath = File.expand_path(targetFileName) > scut.Save > scut > end > > (btw, this is included in my rag-tag util lib you can get here: > http://www.clabs.org/dl/clutil/) I can't answer your question -- my eventual goal is to know less about Windows, not more -- but your mention of Delphi caught my eye. I haven't really touched Delphi in years, but I was always impressed by it. I assume you know about the Ruby/Delphi bridge that someone has made? I think it's called Apollo... I can't quite remember the author, but it's in the RAA. When I tested it out, I was very impressed with it. And offhand I'd say it's possible that if Delphi exposes some bit of functionality, then Apollo might very likely expose that same bit to Ruby. Cheers, Hal -- Hal Fulton hal9000@hypermetrics.com