Click here to Skip to main content
13,259,779 members (55,780 online)
Click here to Skip to main content
Add your own
alternative version


25 bookmarked
Posted 15 May 2007


, 15 May 2007
Rate this:
Please Sign up or sign in to vote.
Create download managers using VBScript

Screenshot - SmartDownloadManager1.gif

Screenshot - SmartDownloadManager2.gif


This article gives some basic information about how to create your own download managers.


There are four different steps that must be followed for the application to work. They are:

  1. Adding your own item to the Right Click menu of Internet Explorer.
  2. Gathering required information from the Page using VBScript files, Javascript files or HTML files when the user clicks the added item.
  3. Launching the main application that does the actual downloading.
  4. Programming the main application to download the target file.

Step 1: Adding our own item to the Right Click menu of the Internet Explorer

Internet Explorer offers a built-in registry key to enable the addition of new menu items to the right click menu.

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt

Adding a new subkey to the above key will show a new item in the right click menu of Internet Explorer. Let us add a new key called "Download Now." We have to add the path of a script file to the default value of the key. Internet Explorer launches the script file when the item is clicked.

Step 2: Gathering required information from the Page

The script file should gather information such as the URL, the element which the user right clicked, and so on. This file is launched when the user selects the added item.

var path = document.location.pathname;
var Exepath = path.replace("SmartDownloadManager.htm",
var Doc   = external.menuArguments.document;
var Event = external.menuArguments.event;
var mainURL   = external.menuArguments.document.URL;
var Element = Doc.elementFromPoint(Event.clientX, Event.clientY);
var Anchor  = Element;
var cookie = Doc.cookie;
while( Anchor.tagName!="A" && Anchor.tagName!="HTML" )
    Anchor = Anchor.parentElement;

    lnkURL  = Anchor.href;
    var oShell = new ActiveXObject("Shell.Application");
    var commandtoRun = Exepath;
        "\""+mainURL+"\"" + " \"" + cookie+"\" \"" + lnkURL + "\"","",
        "open", "1");

The above code retrieves the element on which the user has made the right click and stores the reference in the variable Element. A simple while loop is used to check whether the anchor tag has any nested tags, like images, or any other formatting tags. Finally, a simple if condition checks whether the user has chosen the anchor tag or the blank page. It launches the application and passes the required information to the application as command line arguments.

Step 3: Launching the main application

var oShell = new ActiveXObject("Shell.Application");
oShell.ShellExecute(commandtoRun, "\""+mainURL+"\""
    + " \"" + cookie+"\" \"" + lnkURL + "\"","", "open", "1");

The above code launches the main application which does the actual downloading and passes such information as: main page URL, the URL of the link, etc.

Step 4: Programming tha main application to download the target file

static void Main(string[] args)

The arguments that are supplied in Step 3 are stored in the array args of the Main function. Using these arguments, we can easily create a program that downloads the target file. A lot of articles can be found on this topic on the website itself.


Copy the executable folder into any location. There is a file called SetUp.exe in the executable folder. This file has to be executed for the first time and will create proper registry values. Once the file is executed, the location of the files should not be changed, as it will not work properly. If the location of the folder gets changed, the registry of Download Now has to be manually deleted. After deleting the registry, you can safely execute SetUp.exe again to make the new registry values.


  • 15 May, 2007 - Original version posted


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Architect Chronus Corporation
India India
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionHow to insert a menu when right click blank place? Pin
hays.zhao6-Jun-07 22:31
memberhays.zhao6-Jun-07 22:31 
Questionmissing details Pin
thompsonson223-May-07 2:06
memberthompsonson223-May-07 2:06 
AnswerRe: missing details Pin
Arun.Immanuel23-May-07 5:07
memberArun.Immanuel23-May-07 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171114.1 | Last Updated 15 May 2007
Article Copyright 2007 by Arun.Immanuel
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid