Introduction

Autorun is a freeware software that helps to create CDs with AutoPlay feature. The term AutoPlay now describes a (similar) Windows XP feature that launches an application to display picture, music or video content on removable devices.Autorun allows to create AutoPlay CDs for any type of files,ie .exe,.htm,.doc,.pps etc.. Autorun also allows to set a splash screen , which will be displayed when the CD is inserted in to the drive.

Product Info

Product : Autorun.exe

Version : 1.0.0

Licence : Freeware

Author : Satheesh Kumar A P   

Download

Programmer's guide to Autorun

1. Create a plain text file AUTORUN.INF in the root directory of the CD.

2. Make following entries in the AUTORUN.INF file.

[autorun]
open=Autorun.exe filename splashimage
icon=iconfilename

here, filename refers to the path (relative to the path of Autorun.exe) of the file which is to be played or executed automatically. splashimage (optional) is the path (relative to the path of Autorun.exe) of the image file which is to be displayed when the CD is inserted in to the drive. And the iconfilename specifies the path (relative to the root of the CD) of the icon , which is to be set as the icon of the CD drive.

Note: By using relative path names you can place Autorun.exe, filename,spalshimage etc. are anywhere in the CD. relative path names for filename and splashimage must be relative to the path of Autorun.exe. Other entries can have relative path names based on the root of the CD. If you do not specify ane splash image then it will not show any splash screen.

3. Now you can burn the CD. Make sure that each files are kept in their appropriate positions.

Example

Following example shows how to create an Autoplay CD for an html file.

AUTORUN.INF

[autorun]
open=Files\Autorun.exe ..\index.htm splash.jpg
icon=icon.ico

here ,the Autorun.exe and splash.jpg are placed in a directory named Files in the root directory of the CD.   index.htm and icon.ico are placed in the root directory of the CD.

Tips :

Use the Windows Notepad application to edit plain text files (it is in the Start+All Programs+Accessories menu).
Your CD users may have switched off AutoRun. This might be because they are concerned about viruses. Also, if they press the Shift key down while inserting the CD, AutoRun is disabled. In Windows NT4, 2000 and XP systems, only Administrators and Power Users can use AutoRun. AutoRun must be enabled to AutoPlay CDs. (See: Enabling AutoRun )

There is no way to force your users to use AutoRun. It is therefore good practice to provide instructions so that users know how to start your CD, eg tell them to open file index.htm in their browser. These instructions are also required if your CD might be viewed by non-Windows users.

How Autorun works

Autorun runs a program when a CD is inserted into a Windows computer. If Windows finds a file called AUTORUN.INF in the root directory of the CD then it follows the instructions in this file to run a program. In the above example Windows executes Autorun.exe with the parameters specified . Autorun.exe will show a splash screen by using splash.jpg. Then it plays the index.htm.

Notes :
Autorun uses the default file associations to display the file. Windows associates a viewer program with each file type. For .HTM and .HTML web pages, the viewer program will be your default browser.

If a user does not have a viewer for your file type then it cannot be displayed until a viewer is installed. For example, if you are trying to show a PDF file, the user must have Adobe™ Acrobat Reader or equivalent installed.

If a viewer is not available, the Autorun simply ignores Autoplay.

Why is Autorun needed?

Until recently, it was not possible for Windows to AutoRun a file rather than a program.
OK, that's not strictly true: you could use the following AUTORUN.INF to show web page index.htm

[autorun]
open=start index.htm

However, if you do this, Windows displays a DOS box briefly, which looks nasty. (And start might not be available on some systems.).If you are only targeting recent Windows systems, then you can use the shellexecute command to open a file without a flickering DOS box:

[autorun]
shellexecute=index.htm

What does Autorun do then?
Autorun overcomes the above problems. It shows a splash screen and displays your file. Autorun works in all Windows systems.

Enabling AutoRun on your computer

To test AutoRun you need to have it enabled on your computer. A registry setting can be used to disable AutoRun. Click Start+Run then type in regedit. Select Edit+Find and type in NoDriveTypeAutoRun. This value should be found in this key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer .
The NoDriveTypeAutoRun value should be hexadecimal 95 if AutoRun is enabled on all CDs, or B5 if disabled for CDs. (If you want to test AutoRun on a floppy disk, set this value to 91.) You may need to change more than one instance of NoDriveTypeAutoRun in the registry. You usually need to reboot for a new value to take effect.

In Windows 95/98/Me the NoDriveTypeAutoRun value is displayed as 95 00 00 00. In Windows NT4, 2000 and XP this value is displayed as 0x00000095 or hexadecimal 95. If you modify the NoDriveTypeAutoRun value make sure it is still in the correct format.

More ways to disable AutoRun

There are two other - uncommon - ways of disabling AutoRun. The NoDriveAutoRun registry value is in the same key as NoDriveTypeAutoRun. Each bit represents each drive, so hexadecimal 01 disables AutoRun for floppy drive A, 04 disables AutoRun for drive C, 10 disables AutoRun on E. Values can be combined, so 19 disables AutoRun on E, D and A.
If either NoDriveTypeAutoRun or NoDriveAutoRun specify that AutoRun should be disabled for a drive, then it is disabled for that drive.

Finally, programmers might like to know that AutoRun can also be disabled by the program that controls the foreground window by handling the "QueryCancelAutoPlay" Windows message. Please consult the Microsoft documentation for more details.

More AutoRun options

You can set further options in the AUTORUN.INF file.
You can provide an icon for the CD drive in My Computer by adding a line that set the icon command to an .ICO file.
You can set a text label for the drive using the label command.
For example:
[autorun]
open=Autorun.exe seminars.pps spalsh.jpg
icon=seminars.ico
label=Seminar Reports
Use a series of shell commands to specify one or more entries in the pop-up menu that appears when the user right-clicks on the CD icon. (The shell entries supplement the open command.)
This example shows how to add two entries to the menu (Read me - to display the README.TXT file in Notepad, and Seminar Reports - to show HTML file Seminars.htm):

[autorun]
...
shell\readme\command=notepad README.TXT
shell\readme=Read &me
shell\seminar\command=Autorun.exe Seminars.htm
shell\seminar=Seminar Reports
Any verb string (without spaces) can appear after "shell\"; "readme" and "seminar" were used above.
On one line, append "\command=" followed by the command you want to run. On the next line, append "=" and the text that appears in the menu. Put an ampersand character (&) before the character that should be used as the menu item short-cut key.

Enhanced CDs - music and data

Enhanced CDs contain both audio and computer data, so they can be played on audio equipment and used on a computer. (Enhanced CDs are also known as CD Extra or CD Plus CDs.) Note that the Mixed-mode CDs also contain audio and data, but these may not be playable on audio equipment.

Note that not all Windows computers will recognise the data on an Enhanced CD, although the audio is always seen. (Windows Me, 2000 and XP usually seem to recognise Enhanced CD data, but it may be drive dependent.) Therefore, do not use this format if you want to be sure that your data is available. If the Enhanced CD data does not have an AUTORUN.INF file, then Windows will usually start playing the CD when it is inserted. However, if an AUTORUN.INF is present, then Windows will follow the instructions in there rather than playing the CD. The data on an Enhanced CD can only use short filenames or folder names. Long filenames will be truncated to an "8.3" form, eg "index.html" may appear as "INDEX~1.HTM".


Copyright © 2005 Satheeesh Kumar A P