[REBOL] Re: Exploring System Port
From: james:mustard at: 15-Oct-2002 16:38
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
' ------------------------------------------