Keith Joubert logo - home.

Home
Contact

Binary Search
Sort Multiple Columns
Filing Functions
Extracting Excel data
Read and Write .csv files
Show Progress Messages
Send Automatic Email
Running under .hta
Setting Folder Attributes
Long-script warnings
Desktop Shortcut


 

 
SHORTCUT - DESKTOP  ICON

If you have produced an application running under .hta or .exe, a desktop shortcut icon to startup your application is useful and gives a nice finishing touch.

Write a small Javascript file, or incorporate the following into your setup code:

function createShortcut() {
   if (ActiveXObject) {
      WshShell = new ActiveXObject( "WScript.Shell" );
      strDesktop = WshShell.SpecialFolders("Desktop");
      oShellLink = WshShell.CreateShortcut(strDesktop + "\\blahblah.lnk");
      oShellLink.TargetPath = path;  // eg "C:\\XXX\\Program\\blahblah.hta";
      oShellLink.WindowStyle = 1;
      oShellLink.Description = "BlahBlah";
      oShellLink.WorkingDirectory = strDesktop;
      oShellLink.IconLocation = image path;   // eg "C:\\XXX\\Program\\images\\your_icon.bmp";
      oShellLink.Save();
   }
}

Chose a 68 x 68 pix image for your icon.  A useful site for image conversions to icons is:  CoolUtils

This code will result in a shortcut on your desktop, labelled "BlahBlah".

Enjoy!

TopTop