Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I autorun a CD with a web page on? 3

Status
Not open for further replies.

rich32

Technical User
Oct 16, 2002
7
US
HI.

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?

Thanks
 
make a file called auto run, and put

[autorun]
open=page.html
icon=icon.ico < Your icon
label=Your Label

You can leave the icon and label out if you dont want them..
J x
 
Does the file name have to be &quot;autorun&quot;?

The page I want to open is called &quot;index&quot; so do I write:

[autorun]
open=index.html or....

[autorun]
open=page.html

Does this file then go in the same file as the index page?

Thanks for your help.
 
You put

[autorun]
open=index.html

- when i wrote open=page.html , it was merely an example!

substitute page.html with then name of your file

John x
 
Still cannot get it to run!

[autorun]
open=index.html

I write this in Notepad. Its in the same place as the index.html page but it does not run.

Rich

 
You need to create a text file called autorun.inf and keep this in the site root folder.

In the autorun.inf file, type the code as above.
 
DarrenPowe is correct, you have to save the text file as AUTORUN.INF and copy it to the root folder of your CD drive.

[autorun]
open=index.htm
 
I tried your advice, but my CD says F:\ not a valid win32 application.



What do I do?
 
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:

[Autorun]
open=PTStart.exe page.html

 
So does the other persons computer need the pstart too?
 
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)

Chip H.
 
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.


(note: my experimentation indicates the script above MUST be a frame action)
 
************** Create a cd that will autorun


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:

[autorun]
open=command /c start index.htm
icon=index.htm

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=&quot;JavaScript&quot;>
<!--
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.
 
Thanks hassified!

Your instructions worked for me.

Faded
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top