I have put a web page on a CD for a client.He has to view it on PC and Mac. What command do I use to make the CD autorun so that the web page opens up in the browser automatically?
I was just fighting with this same issue tonight, when I found this thread....
autorun.inf can only run executables. You can download one of various little programs that enable you to run an html page. Simple query in a search engine will find you one of those. I used PTStart.exe, and than my autorun.inf looked like this:
Since the autorun.inf is limited to running executables, you'll need to find a C programmer friend to write you a short application that uses the Win32 API ShellExecute() to run your index.html (it has the ability to open the default viewer for a file type, and so it would work with either IE or NS)
Web authors here should note that you can make a Flash projector to use as an application launcher for your CD. Set a button to goto a frame and set the frame actions like the script in the link below. Set the last frame action to goto the frame where your buttons reside and allow your clients to launch another app/document.
To create a cd that will auto run create the file ‘AUTORUN.INF’ in the cd’s root directory. This is a simple text file (so use notepad to edit it).
The ‘AUTORUN.INF’ file must start with the following line:
[autorun]
It can then include any of the following commands, each of which is optional:
icon=icon.ico
Specifies the name of the icon file that will be used by explorer as the icon for that cd.
This may be the name of an executable file that contains an icon. If the executable contains more than one icon then an optional index field can be specified to indicate which icon to use: icon=iconfile,index
label=text
label Text label that will be displayed against the cd within explorer.
open=exefile
Specifies the command that is to be autorun when the cd is first inserted. It may include a path and any arguments.
ShellExecute=datafile
Specifies an application or data file that is to be opened. Windows will launch the application associated with that file type to open the datafile.
Note: ShellExecute is not supported under all versions of Windows (e.g Window 98).
For example to create a cd that will autorun the program ‘setup.exe’ would require an AUTORUN.INF file similar to:
[autorun]
open=setup.exe
icon=setup.exe
To create a cd that will autorun to open the html file ‘index.htm’ would require:
[autorun]
ShellExecute=index.htm
icon=index.htm
However, since not all versions of Windows support ‘ShellExecute’ a less elegant alternative would be:
Be aware that the use of ‘command’ and ‘start’ restrict this to machines running Windows.
________________________________________________________________________
************** Test cd autorun without burning a cd
When producing a cd that will autorun the easiest way to test whether the contents of the autorun.inf file are correct is to blow a cd and try it. There are a few methods that allow you to test the cd autorun without burning a new cd:
Autorun subst drive (not XP)
The DOS command 'subst' allows a path to be assigned to a drive letter. To use this command open up a new 'command prompt' (either use start > run and enter 'cmd', or run find it under the Programs menu).
Assuming that the cd image that you wish to test is in the folder 'C:\MyThings\MyCD' then (in the command prompt) type:
subst T: C:\MyThings\MyCD
This will associate the drive letter 'T' with the folder 'C:\MyThings\MyCD'. (Any free drive letter can be used, it does not have to be 'T'.) Within windows explorer the 'T' drive will now be listed, whilst it will not automatically run the autorun file by right clicking the drive within explorer the option should be available to 'AutoPlay'. If the option is not available then check that there is an 'autorun.inf' file in the folder and that it is correctly structured.
One thing to note about this mechanism is that Windows appears to cache information about the autorun settings. If you then edit the 'autorun.inf' file delete the drive substitution and recreate it before testing you changes. For example:
subst T: /d
subst T: C:\MyThings\MyCD
Otherwise you may find that windows does not pick your changes up.
Note: This has been tested under Windows 98 and Windows 2000. It does not appear to work under Windows XP.
************** Create a cd that will autorun an HTML file maximized
For notes on how to create a cd that will autorun please refer to the article ‘Create a cd that will autorun’ after method 2.
To create a cd that will autorun to open the html file ‘index.htm’ non-maximized would require the following ‘autorun.inf’ file:
[autorun]
ShellExecute=index.htm
There are two methods to create a cd that will autorun, displaying an HTML file maximized:
Use windows shell to maximize it
Use Javascript to maximize it.
*** Method 1: Use Windows Shell
The following ‘autorun.inf’ file invokes the command processor to start a full screen browser on the html file ‘index.htm’:
--------------------------------------------------------------------------------
****CODE STARTS HERE***
[autorun]
open=command /c start /max index.htm
--------------------------------------------------------------------------------
Be aware that the use of ‘command’ and ‘start’ restrict this to machines running Windows. It is therefore not portable to other platforms
*** Method 2: Use Javascript
An alternative approach is to use JavaScript to maximize the HTML file after it has been displayed. The ‘autorun.inf’ file requires nothing other than to invoke the browser:
[autorun]
ShellExecute=index.htm
In order to be maximized the HTML file would require the following Javascript to be included. The obvious place for it would be just inside the opening '<BODY> tag or just before the closing '</HEAD>' tag.
--------------------------------------------------------------------------------
****CODE STARTS HERE***
<script language="JavaScript">
<!--
if (document.all || document.layers)
{
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight)
}
//-->
</script>
--------------------------------------------------------------------------------
The disadvantage of this approach is that it isn't strictly maximizing the window - it is resizing it to take advantage of the full screen size, but it should be portable to non-Windows platforms.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.