[REBOL] Re: creating a shortcut
From: james:mustard at: 24-Dec-2003 22:43
Hi guys - we discussed this back in October '02 for the simple making of
shortcuts under windows (except windows 95 - you need the windows scripting plugin).
###########################################
PLease note - if you do NOT have access to Pro then you can use the browse
functionality to launch the *.sh script file - or if you are feeling
particularly clever, you can redirect the browser from explorer.exe to wscript.exe.
###################################
Ashley wrote:
> I don't suppose there is a handy one for "create a short-cut on the
> desktop" regardless of what Windows version it is? ;)
The easiest way I know of (which doesn't depend on esoteric fCreateShell dll
calls) is to call a windows scripting object file (a *.sh text file) which
will get run by the windows scripting host (provided it is installed -
default in win98 SE upwards - IIRC).
then from rebol its a simple shell call using the ShellExecute API
specifying the name of the script to call.
a sample script file (sample.sh) could contain:
' ------------------------------------------
Set WSHShell = WScript.CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
'Create shortcut to database program
Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\I am a
shortcut.lnk")
with MyShortcut
.TargetPath = "C:\wherever\whatever.exe"
.WorkingDirectory = "C:\wherever"
.WindowStyle = 4
.IconLocation = "C:\wherever\whatever.exe, 0"
.Save
end with
' ------------------------------------------
Regards,
James.