BootScriptor Tutorial
BootScriptor Tutorial
BootScriptor Tutorial
By : Ahmad Hisham
BootScriptor Tutorial
By: Doctor xp
We first need to build a user interface for our script, this is very simple.
We need the color / highlight /cls / print / setpos / type commands to build a good looking interface, these
commands do many things as to set the position of the text on the screen, align it, and specify its colors.
1. Create a text file with any text editor (I personally recommend Edit plus but Notepad will do the job) and save it in
the /bscript folder and name it textinfo.txt.
2. Create the startup script file, its name must be bscript.ini.
The script file contents will be :
;
; Example 1 : Display text in various attributes
;
; Section 1: Setting Colors
color 0x1f
highlight 0x1e
cls
; Section 2: PRINT tags
print "This is plain text (not very interesting) \n" ; text with no special tags
print "We can try the \cXXHighlighted\cxx text \n"
print "Maybe colored text like : \c1cred text\cxx and \c5fviolet background\cxx\n "
print l "You aren't interested in colored text !!! \n"
print c "You should try the centered text \n"
print r "Or even right aligned text \n"
; Section 3: Positioning text
setpos 30 10
print "I think you must try positioned text \n"
setpos 15 13
print "You can place the text anywhere \n"
; Section 5: Using ready-made text files
Page 1 of 12
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
follows a semi-colon will be considered as a comment till the end of the line.
The first section contains the color and highlight commands, these commands specify the screen color the
highlighted text color, to specify a text as highlighted use the \cXX Highlighted text \cxx form, \cXX means that
the text after it is highlighted text, and \cxx means that the following is normal text, to specify which color to use the form
color 0xbackcolorforecolor, use the table below to select the color character
Code
0
1
2
3
4
5
6
7
Color
black
blue
green
cyan
red
violet
brown
grey
Code
8
9
A
B
C
D
E
F
Color
dark grey
bright blue
bright green
bright cyan
bright red
bright violet
yellow
white
That means that the screen color "0x1f" is blue with white text and the highlighted text color "0x1e" is yellow on a blue
background.
The next line clears the screen, it also paints all the screen with the colors previously specified.
The following section uses the print command with the tags \c - \t - \n , and the special parameters l/c/r.
The \c tag specifies the color of the text and its background, it uses the same color table and its form is
\cbackcolorforecolor, it could also take the parameter xx which means that the following text is in normal color or
the parameter XX which means that the following text is in highlighted color.
The print command accepts the parameters l/c/r and the text to be displayed, the l/c/r parameters specify the
alignment of the text, it means align Left, Center the text or align Right.
Page 3 of 12
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
Note that each print command is ended with the \n tag, it ends the current line and move to the next line (prints a
carriage return).
The third section uses the setpos command, its syntax is setpos <x/xpos> <y/ypos>, and its function is to set the
position of the curser so that the text in the subsequent commands are written starting from that position.
Its parameters are the coordinates of the new curser position in the screen.
Note: the screen limit is 80 characters in the x-axis and 25 lines in the y-axis.
You can also keep the current x or y axis numbers by using any of the parameters x or y.
The last section uses the type command, which do what it says, it types text files on the screen, in this case the
textinfo.txt file.
By using the above commands and using your imagination, you can create the interface you want for your CD, and
remember that the best script hasn't been yet created.
Page 4 of 12
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
In order to make a readable and an efficient script you must divide it into sections, sections provides a way to create
complex scripts that accepts user commands and input and interacts with it.
Here is our second script:
;
; Example 2 : Divide the script into sections
;
;the main section a.k.a "the section with no name"
cls
start:
print "I'll go to the second_section"
goto second_section
; a section
second_section:
print " == Welcome to the second_section == "
print "I'm now in the second_section"
print "I will jump to sub_addtext and come back"
call sub_addtext
print "I'm Baaaaaaaack"
end
; A subroutine
sub_addtext:
print " == Welcome to the sub_addtext == "
print "This is just a visit to the sub_addtext"
print "I'll soon return to where I came from"
Page 5 of 12
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
return
Now we need to understand,
Each section must have a name, the section name is written at the beginning of it in the form sectionname: and must
have its own line.
To move between section you use the goto command, its syntax is goto sectionname.
But the goto command is a one way trip, you can't return from where you moved, for this reason there is the
call/return commands.
You move to the section (or the subroutine) wanted with call command, and you end the section with the return
command, the return command continues the running of the commands after the call command.
The last command is the end command, it simply ends the script and return to the BootScriptor console, we need this
command to stop the script from ending the second_section and moving to sub_addtext without warnings.
Page 6 of 12
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
To create a truly interactive script we have get the user feed back for our interface and act as the user demands.
You can detect the keys pressed and correspond with actions by the getkey / onkey commands.
1. Create the startup script file, its name must be bscript.ini.
The script file contents will be :
;
; Example 3 : Respond to User keys
;
; Section 1: Printing the Interface
color 0x0f
highlight 0x0e
start:
cls
setpos 1 4
print c " == \cXXThe CD Colors Menu\cxx ==
print c "\n"
print c "1. Use \cXXG\cxxrey background\n"
print c "2. Use \cXXB\cxxlue Background\n"
print c "3. \cXXE\cxxxit
\n"
print c "\n"
print c "Select an option :
"
\n"
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
The second section starts with the getkey command, its syntax is getkey [timeout] [action], it waits for the user
to press a key for timeout seconds and if there is no key pressed automatically do action or store the pressed key for
the onkey command (to check it later).
The onkey command has the syntax onkey <key> <action> , it checks the last key the user pressed, and if it
matches key, then action is performed (that means that our command waits for 30 seconds before running the
command end); if the keys do not match, then no action is performed and the script continues on the next line.
You can use keys other than the alphanumeric characters, see onkey in the command reference.
Action can be a single command as end or print, or it can be a goto or call command that move to another section
and start performing the actions in this section.
Page 8 of 12
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
Also you can use more than one onkey command to do the same action.
If the key that was pressed doesn't match any of the checked characters (in this case g , b , e and the Escape keys) it will
continue without performing any action and will move to the third section which uses a print command to notify the user
that the key pressed is not associated with any action and wait for a second before going to the start section.
Another way in handling invalid characters you can use is to put a section label "checkforkeys" before the getkey
command and use the command "goto checkforkeys" in the forth section, this doesn't give any error messages and
continues to watch the keyboard for the next key pressed.
Note that the last line in the first section doesn't contain the \n tag, that enables that the message "Invalid option"
shows next to the "Select an option :" prompt and not in the next line.
The last section uses normal BootScriptor sections to provide the ability to do multiple actions for the key pressed (in this
case the g or b keys).
Page 9 of 12
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
We have learned all the basics of the BootScriptor scripts by now, but we haven't.
1. Create the startup script file, its name must be bscript.ini.
The script file contents will be :
;
; Example 4 : Running the bootable disk images
;
; Section 1: Printing the Interface
color 0x1f
highlight 0x1e
start:
cls
setpos 1 4
print c "
== \cXXThe CD Main Menu\cxx ==
print c "\n"
print c "\cXX1\cxx. Start the Windows 98SE Setup
print c "\cXX2\cxx. Start the Windows 2000 Setup
print c "\n"
print c "\cXX3\cxx. Boot from the Hard Disk
print c "\cXX3\cxx. Restart the system
print c "\cXX4\cxx. Exit
print c "\n"
print c "Select an option :
"
\n"
\n"
\n"
\n"
\n"
\n"
http://911cd.tripod.com
BootScriptor Tutorial
onkey
onkey
onkey
onkey
By: Doctor xp
3 goto boothdd
4 reboot
5 end
esc end
The second section uses with the getkey to get the user selection and respond to it with onkey command and it has
also been discussed in lesson 3, the new here are the responding commands, they are :
memdisk bootdisk.img :
The memdisk command attempts to boot from a floppy or hard disk image file (image files can be created using dd
or RAWwrite Win or WinImage), by calling on Memdisk to emulate the disk's hardware. The Memdisk program file
must be present in the home directory.
The bootdisk.img specifies the filename of the floppy disk image file to boot from (relative to the current
directory). For information about the types of files accepted by Memdisk view its documentation.
Page 11 of 12
http://911cd.tripod.com
BootScriptor Tutorial
By: Doctor xp
chain w2ksetup.dat :
The chain command is used to chain-load a no-emulation CD boot sector. The most common use of this
command is to load the Windows NT/2000/XP CD-ROM boot sector to make a bootable Windows NT/2000/XP
installation CD, it may be used also to load any other CD boot sector.
The w2ksetup.dat specifies the boot image filename to chain-load. The image file size is limited to 64kb.
reboot :
Reboots the system, you may specify either the cold or warm parameter which will execute a cold or warm reboot,
respectively (the default is warm).
The third section uses the check / boot commands to boot from the hard disk, to do that you use the boot 0x80
command (you can boot from the floppy drive A: by using the parameter 0 , or the second hard disk by the parameter
0x81).
But the hard disk maybe unbootable, so when the boot command is executed it generates an error and stops the script, to
avoid that we use the check command which checks to see if the drive seems bootable and acts upon the result.
In our script we use the form "check c 0x80 p boot 0x80" which checks to see if the boot partition can boot the
system and only then runs the boot command (for more information about the check command syntax, see the
commands reference).
The Boot Scriptor program is very versatile and configurable, its real strength relies in its scripting capabilities and ability
to shield the average user from the command line, you can now see some of the more advanced scripts in the Example
scripts section, they are based on same concepts here but uses real-life scenarios, keep in mind that you don't rely on just
Boot Scriptor, you use other tools to create truly interactive bootable CDs that offer the user the greatest help.
Page 12 of 12
http://911cd.tripod.com