473,890 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows CD autorun program

Hello all,
I needed this and did a quick search around and didn't see any
examples.
I knew it had to be easy, and it was.
So here it is a CD_Autorun program in python.
It is very simple and without comments is only about 30 lines.
Also included a setup.py at the end of the script so you can
'compile' it easily.

py>############ ############### ############### ############### ############
py># CD_Autorun.pyw
py># tested on windows 98, windows 2000
py>############ ############### ############### ############### ############
py># Why, you ask , because it was sorta easy and free ;)
py># Really I just have fun writing my on tools and I
py># needed a simple autoloader for a project I am working on.
py># It is not full featured and guarnteed to have a few bugs.
py>############ ############### ############### ############### ############
py># 'compile' with py2exe or McMillan Installer
py># All you need now is this and autorun.inf file on your cd
py># You can run this first to generate your autorun file.
py># Then you can edit at will, or leave default for index.htm
py># To make a CD autorun under windows you have
py># to have an autorun.inf file in top level of your cd.
py># For autorun.inf syntax go to msdn or just google it.
py>############ ############### ############### ############### ############
py># We need few files to get going
py># autorun.inf <-create with this program, run once
py># CD_Autorun.exe <-create this with py2exe or McMillan Installer
py># *.* <-any other files creted by py2exe or McMillan Installer
py># CD_Autorun.ico <-name your cd icon this or edit autorun.inf
py># index.htm or your_file <-your file
py># Put them all in the top directory and edit your autorun.inf
py># to your_file_name if you didn't already.
py># then just use your favorite cd burning software and burn it.
py># Put the disk back in the cd tray and it should
py># autorun your program.
py>############ ############### ############### ############### ############
py>__version__ = '.1'
py>import os, sys, traceback
py>pathbase = os.path.split(s ys.executable)[0]
py>autorun = os.path.join(pa thbase,'autorun .inf')
py>if os.path.exists( autorun):
py> try:
py> if len(sys.argv) > 1:
py> try:
py> item = sys.argv[1]
py> try:
py> args = sys.argv[2:]
py> except:
py> args =[]
py> path = os.path.join(pa thbase,item)
py> args.insert(0,p ath)
py> args = ' '.join(args)
py> os.spawnl(os.P_ NOWAIT, path, args)
py> except:
py> try:
py> os.startfile(pa th)
py> except:
py> os.starfile('in dex.htm')
py> else:
py> os.startfile('i ndex.htm')
py> except:
py> os.startfile('i ndex.htm')
py>else:
py> try:
py> autorun_templat e = """[AutoRun]
py>open=CD_Auto run.exe index.htm
py>icon=CD_Auto run.ico
py>"""
py> autorun_file = open(autorun, 'wt')
py> autorun_file.wr ite(autorun_tem plate)
py> autorun_file.cl ose()
py> except:
py> traceback.print _exc()
py>sys.exit(0)
py>############ ############### ############### ############### ####
py>## I prefer to use McMillan Installer
py>## and use the onefile option, it just looks cleaner to me.
py>## I will leave that for you to figure out.
py>## It isn't hard.
py>############ ############### ############### ############### ####
py>## This is for py2exe.
py>## Remeber you can use --icon to change the icon(win2k only?)
py>############ ############### ############### ############### ####
py>## setup.py py2exe
py>############ ############### ############### ############### ####
py># from distutils.core import setup
py># import py2exe
py># setup(name="CD_ Autorun",
py># scripts=["CD_Autorun.pyw "])
py>############ ############### ############### ############### ####
py>## 2004 M.E.Farmer Jr.

Jul 18 '05 #1
0 2365

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
5077
by: Ray5531 | last post by:
I'm looking for a good Freeware autorun maker for my C# application.Any suggessions? Thanks
17
6463
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
9
1349
by: Miro | last post by:
Wondering if anyone here has come up with a different solution than I keep coming back to: Here is a thought and I just can't seem to come up with another solution other than to install my old VB6 cds'. I want to create a nice splashy screen that will run from ( Autorun.inf ) on a CD when a cd is installed.
2
1550
MrMancunian
by: MrMancunian | last post by:
Hi Everybody, We've got a virus problem in our department and the thing it does is always the same. It creates an autorun.inf in the root of every partition. When the partition is accessed (or initialised, I'm not sure), the autorun.inf runs an executable. I was thinking I could write a program/script that checks all available disks for an autorun.inf and either replaces or deletes the file. This way, the executable doesn't run. Now, surely...
0
6130
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: Overview NOTE- This complete article on "Windows Autorun FAQs" applies theoretically to all Windows NT-based OSes till Windows Vista (and probably Vista's successors too). Much of the contents of this article are tested on Windows XP professional SP2 by the author. Some instances of this article may be altogether different/missing on Windows Vista, XP and other Windows NT systems, but I have tried to write a...
0
9230
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: Description NOTE- If you are unfamiliar with the concept of autoruns, then read "Windows Autorun FAQs: Overview". Que-1: How can I safely remove or edit the autorun settings on my PC? Ans: I recommend that you backup all of your important data before trying anything mentioned in this article. When a person is tweaking with autoruns, one has to rely on 'trial and error' methods and so there is always the possibility...
0
30281
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: List of autostart locations Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list all the autostart locations for windows? Ans: Here is a comprehensive list of all autostart locations for Windows OSes: NOTE : These are some abbreviations used in this list. Please note them carefully: HKCU = HKEY_CURRENT_USER HKLM = HKEY_LOCAL_MACHINE
0
9975
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: Programs dealing with autoruns Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list programs that help me to view/modify the autoruns on my Windows PC? Ans: Other than Sysinternals Autoruns, there are only a few programs which are good enough to be used when dealing with autoruns. For more information about Sysinternals Autoruns, read Que-7 in Windows Autorun FAQs: Description....
0
11222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10810
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10918
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8015
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7169
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6041
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4674
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3275
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.