Welcome to BENEdit. This is a text editor that allows you to create and edit batch files quickly and easily.
BENEdit and BEN (the Batch ENhancer) work together to provide you with the perfect environment to do all your batch works. Now, you can use all your time to productive means by accessing all the features of BEN inside BENEdit. Just select any BEN function under the "BEN Functions" menu and answer a few questions. BENEdit will instantly create the necessary batch program lines for you. Creating batch files is never so easy before!
menu is accessed by pressing Alt-Space. All the other menus are accessed by pressing Alt-Z, where Z is the first letter of the menu. For example, the "File" menu is pulled down by Alt-F, and the "BEN Functions" menu is pulled down by Alt-B. H
For More Information
Choose one of these for more information:
Alphabetical
listing
functions
Borderstyle
Color
Using
editor
Registration
Find
dialog
(text
search)
Replace
dialog
Edit
File
command
File
command
Press ESC to put this help screen away.
The Editor
There are many ways to get into an open Edit window (make it active):
1) Click it.
2) Press Alt-# (where # is that Edit
window's number).
3) Choose the window from the Window
dialog box.
4) Press (or click) F6 to cycle through the
open windows.
To close the active Edit window, choose Window
Close. Q
Once in the Edit window, you enter text just as if you were using a typewriter. P
When you want to end a line, press Enter.
To exit the editor, press F10.
See also: E
Cursor
Movement
Commands
Insert
Delete
Commands
Block
Commands
How to run BEN:
Format: [d:][pathname] BEN function [params] [functions
[params]...]
Entering the command "BEN" alone in DOS gives you an online help of BEN's functions. Make sure that the file BEN.HLP is in the same directory as BEN.EXE. Otherwise, the online help wouldn't work.
To access a BEN function, you must enter the command "BEN" followed by the name of the function. Some functions doesn't require any parameter. An example of this is the BEEP function. You can use it by entering this command into your batch file:
BEN Beep
Other functions of BEN require one or more parameters. For example, you can clear the screen with the color blue by entering this command into your batch file:
BEN Cls Blue
BEN functions can be "stacked" one after another in a command line. For example, you can group the BEEP function and the Cls function together, one after another. In this case, BEN will first create a beep, then it will clear the screen with the color blue:
BEN Beep Cls Blue
When you stack functions together, you may use the "/" separators if you want. This is not mandatory, but it helps to increase the readability of your batch file. For example:
BEN Beep / Cls Blue
Cursor Movement Commands
Character left
Ctrl-S or Left arrow
Character right
Ctrl-D or Right arrow
Word left
Ctrl-A or Ctrl-Left arrow
Word right
Ctrl-F or Ctrl-Right arrow
Line up
Ctrl-E or Up arrow
Line down
Ctrl-X or Down arrow
Scroll up
Ctrl-W
Scroll down
Ctrl-Z
Page up
Ctrl-R or PgUp
Page down
Ctrl-C or PgDn
Insert & Delete Commands
Insert mode on/off
Ctrl-V or Ins
Insert line
Ctrl-N
Delete line
Ctrl-Y
Delete to end of line
Ctrl-Q Y
Delete character left
Ctrl-H or Backspace
Delete character
Ctrl-G or Del
Delete word right
Ctrl-T
Block Commands
Mark block begin
Ctrl-K B
Mark block end
Ctrl-K K
Copy block
Ctrl-K C
Move block
Ctrl-K V
Delete block
Ctrl-K Y
Hide/display block
Ctrl-K H
Alphabetical listing to all BEN functions
Beep
CleanUp
Color
Cursor
Delay
DirDisp
DirDispA
Echo
EGAVGA
Extract
Flush
GetCD
GetKey
GetKeyL
GetKeyU
GetLine
GetLineL
GetLineU
GetVideo
GrowFilledBox
List
Locate
Menu
MenuF
MenuLCD
Message
Pause
Play
SavePath
Scroll
ShadFilledBox
Shell
Sound
TitledBox
TransparentBox
Write
WriteC
WriteV
(System) menu
(Alt-Spacebar)
The System menu appears on the far left of the menu bar and is represented by the
symbol. (
When you pull down the
menu, you see "
About
Run
MDESIGN
Register
About
When you choose the About command from the
(System) menu, a dialog box appears, showing copyright and version information. G
To close the box, press Esc, Space, or Enter, or click the OK button.
MDESIGN is an utility that is added to the BEN package starting from version 3.10. It allows the user to create and customize a menu which can be accessed from BEN. Like BENEDIT, it is very easy to use. s
Example: If you have created a menu data file called TEST.MNU, you can access it from BEN easily with the command
BEN MenuF TEST.MNU R
Errorlevels are returned to the calling batch file similar to the Menu function.
Register (F4)
When you select the Register option under the menu bar or press F4 at anytime, you will enter the registration dialog box. To register, answer a few questions, and BENEdit will print a registration form for you automatically. All you need to do is to mail this form with the necessary payment. Quick and easy!
Why do you want to register?
You want to register because BEN and BENEdit are NOT free software. BEN and BENEdit are NOT public domain software. BEN and BENEdit are sharewares. You are expected to pay a registration fee to the author of this program if you find it useful. You are allowed to use BEN and BENEdit for free within a trial period of 60 days. After 60 days, if you continue to use BEN, you must register, or you will be violating the law.
When you register, you will get BENMOUSE for free. BENMOUSE is a a bonus version of BEN that has the ability to make use of mouses. BENMOUSE is unavailable anywhere except through registration. 9
When you register, you will get free technical support. 3
When you register, you will get a printed manual. J
When you register, you will boost the economy of the shareware industry. '
Register promptly! Be an honest user! =
There are three editions of BEN available for registration:
A> Personal Edition - $39 Z
With registration, you get the following:
- Complete BEN package on a disk:
- BEN.EXE with your specified registration name
encoded into the code.
- BENMOUSE.EXE (a bonus version of BEN that has the
ability to make use of mouses) with your specified
registration name encoded into the code.
- BENEDIT.EXE with your specified registration name
encoded into the code.
- MDESIGN.EXE with your specified registration name
encoded into the code.
- All other BEN-related files.
- Next version of the complete BEN package on a disk free
of charge.
- One printed manual that covers all aspects of BEN.
- Free technical support.
B> Programmer's Edition - $99 Z
With registration, you get the following:
- Complete BEN package on a disk:
- BEN.EXE with your specified registration name
encoded into the code.
- BENMOUSE.EXE (a bonus version of BEN that has the
ability to make use of mouses) with your specified
registration name encoded into the code.
- BENEDIT.EXE with your specified registration name
encoded into the code.
- MDESIGN.EXE with your specified registration name
encoded into the code.
- All other BEN-related files.
- Next version of the complete BEN package on a disk free
of charge.
- One printed manual that covers all aspects of BEN.
- A distribution license. With this license, you are
permitted to use BEN to create batch utilities that you
can distribute, royalty-free.
- Free technical support.
C> Business Edition - $199 Z
With registration, you get the following:
- Complete BEN package on a disk:
- BEN.EXE with your specified registration name
encoded into the code.
- BENMOUSE.EXE (a bonus version of BEN that has the
ability to make use of mouses) with your specified
registration name encoded into the code.
- BENEDIT.EXE with your specified registration name
encoded into the code.
- MDESIGN.EXE with your specified registration name
encoded into the code.
- All other BEN-related files.
- All future versions of the complete BEN package on a
disk free of charge.
- Five sets of printed manuals that covers all aspects of
BEN.
- A site license for unlimited number of users on a LAN.
- A distribution license. With this license, you are
permitted to use BEN to create batch utilities that you
can distribute, royalty-free.
- Free technical support.
File (Alt-F)
The File menu offers choices for opening files, changing directories, and exiting the program. ?
Open
Save
Save
Change
Print
Shell
Exit
File
Open (F3)
The Open command displays the Open a File dialog box. In this dialog box you select the text file you want to edit. &
The Open
File dialog box contains:
an input
box with a history list
a list
box to browse the directory
the standard Cancel button
Open action button
an information panel that describes the
selected file
File
New opens a new Edit window and automatically makes it active.
File
Save (F2)
Save saves the file that's in the active Edit window to disk. If the file is untitled, then a Save
As dialog box opens so that you can name the file.
File
Save As...
Save As opens a dialog box where you can save the file in the active Edit window under a different name, in a different directory or on a different drive.
File
Change Dir...
Change Dir brings up the Change
Directory dialog box, in which you can change the current directory.
File
Print...
Print command prints the contents of the active Edit Window.
File
DOS Shell
With the DOS Shell command, you can leave the program temporarily to perform a DOS command or run another program. 9
To return to this program, type EXIT at the DOS prompt.
File
Exit
(Alt-X)
The Exit command terminates this program.
Edit
(Alt-E)
The Edit menu provides commands to cut, copy and paste text in Edit Windows. You can also open a Clipboard Window to view or edit its contents. /
You can choose from these Edit menu commands: 0
Undo
Copy
Paste
Clear
Show
Clipboard
Edit
Undo
This command takes back the last editing command you performed on a line. @
It can also take back a CTRL-Y, or text typed on a blank line.
Edit
Cut (Shift-Del)
The Cut command removes the selected text from your document and places the text in the Clipboard. x
You can then choose Edit
Paste to paste the cut text into any other document (or somewhere else in the same document). [
The text remains selected in the Clipboard so you can paste it as many times as you want.
Edit
Copy (Ctrl-Ins)
The Copy command leaves the selected text intact but places an exact copy of it in the Clipboard. x
You can then choose Edit
Paste to paste the cut text into any other document (or somewhere else in the same document). [
The text remains selected in the Clipboard so you can paste it as many times as you want.
Edit
Paste (Shift-Ins)
The Paste command inserts the selected text from the Clipboard into the current window at the cursor position.
Edit
Show Clipboard
The Show Clipboard command opens the Clipboard window, which stores the text you cut and copy from other windows. Any text you cut or copy is appended to the end of the Clipboard. e
The currently selected (highlighted) Clipboard text is the text BENEdit uses when you choose Paste.
Edit
Clear (Ctrl-Del)
The Clear command removes the selected text but does not put it into the Clipboard. Q
This means you can't paste the text as you could if you had chosen Cut or Copy. &
The cleared text is not retrievable.
Search
(Alt-S)
The Search menu provides commands to search for text in your files. $
These are the available options:
Find
Replace
Search
Again
Search
Find...
The Find command displays the Find
dialog
box, where you type in the text you want to search for. t
You can set several options in this dialog box that affect the search. (Ctrl-Q F is a shortcut to the dialog box.)
Search
Replace...
The Replace command displays the Replace
dialog
box, where you type in the text you want to search for and text you want to replace it with.
Search
Search Again
The Search Again command repeats the last Find or Replace command. ]
All settings you made in the Find dialog box remain in effect when you choose Search Again.
Window
(Alt-W)
The Window menu contains commands to close, move and perform other window-management commands.
Most of the windows in this program have all the standard window elements, including scroll bars, a close box, and zoom icons.
Window-management commands
Tile
Cascade
CloseAll
Resize
Zoom
Next
Prev
Close
Ascii
Table
Calculator
Window
Size/Move
(Ctrl-F5)
Choose this command to change the size or position of the active window.
Size
If you press Shift while you use the arrow keys, you can change the size of the active window. Once you've adjusted its size or position, press Enter. Q
If a window has a Resize corner, you can drag that corner to resize the window.
Move
When you choose Window
Size/Move, the active window moves in response to the arrow keys. Once you've moved the window to where you want it, press Enter. F
You can also move a window by dragging its title bar with the mouse.
Window
Zoom
(F5)
Choose Zoom to resize the active window to the maximum size. If the window is already zoomed, you can choose this command to restore it to its previous size. {
You can also double-click anywhere on the window's title bar (except where an icon appears) to zoom or unzoom the window.
Window
Tile
Choose Window
Tile to tile all file viewers on the desktop. L
Tiled Windows
Window
Cascade
Choose Window
Cascade to stack all file viewers on the desktop. A
Cascaded Windows
Window
Close all
Choose Close All to close all the windows on the screen.
Window
Next
Choose Next to cycle forwards through the windows on the desktop.
Window
Previous
Choose Previous to cycle backwards through the windows on the desktop.
Window
Close
(Alt-F3)
Choose Close to close the active window. O
You can also click the Close box in the upper right corner to close a window.
Window
ASCII table
The ASCII menu items opens an Ascii table that displays the IBM PC character set. The current character is marked by a blinking block cursor, and the hexadecimal and decimal ASCII values of the character are displayed below the chart. A new character is selected by pressing it on the keyboard, by clicking the mouse on it in the chart, or by moving the cursor using the cursor keys.
Calculator
When you choose Calculator, a four-function with add, subtract, multiply, and divide ability is opened on the desktop. -
To operate the calculator you can either use the keyboard or press the buttons on the calculator with the mouse. The 'C' key clears the calculator, the '
' key will erases the last character typed, and the '
' key toggles the value from positive to negative (the keyboard equivalent of '
' is '_').
BEN Functions
(Alt-B)
The BEN Functions menu consists of six submenus. Each of these submenus contain a different category of BEN functions that you can access.
When you select a BEN function inside any of these six submenus, you will only need to answer a few questions (or sometimes, no question at all) and BENEdit will automatically insert the correct BEN command line into the current editing window.
These submenus are: p
Functions
Input
Functions
Message
Functions
Music
Functions
Screen
Functions
Miscellaneous
Functions
Box Functions
The Box Functions menu is a submenu under the BEN
Functions
menu. All the functions under this menu can draw boxes on the screen: J
function that draws an empty box on the screen with an upper-left corner of (x1,y1) and a lower-right corner of (x2,y2). o
Example
BEN Box 1 1 80 25 White Blue 1
BEN Box 10 10 20 20 Yellow Black 3
BEN Box 4 4 8 8 9 2 65
Borderstyle
Borderstyle can be one of the following:
0 - no border
1 - single line box (
2 - double line box (
3 - double sides, single top and bottom
4 - single sides, double top and bottom
5 - single left and upper, double lower and right
6 - menu box style
7+ - the border is drawn using the ASCII character represented by
the style value.
Color
The "colors" available for use are Black, Blue, Green, Cyan, Red, Magenta, Brown, LightGray, DarkGray, LightBlue, LightGreen, LightCyan, LightRed, Light Magenta, Yellow, and White.
You can also specify the colors with a number if you want. For example, instead of using the word "Black", you can use the number 0. Instead of using the word "Blue", you can use the number 1. And so on. ?
Here is a list of the colors and their corresponding numbers: G
function that draws a filled box onto the screen with an upper-left corner of (x1,y1) and a lower-right corner of (x2,y2). This filled box grows out onto the screen for a spectacular effect.
function that draws a filled box onto the screen with an upper-left corner of (x1,y1) and a lower-right corner of (x2,y2). This filled box has a shadow.
Example
BEN ShadFilledBox 1 1 80 25 White Blue 1
BEN ShadFilledBox 10 10 20 20 Yellow Black 3
BEN ShadFilledBox 4 4 8 8 9 2 65
TitledBox Function
Syntax: TitledBox x1 y1 x2 y2 foreground background borderstyle title
This is a box
function that draws a filled box onto the screen with an upper-left corner of (x1,y1) and a lower-right corner of (x2,y2). This filled box has a title. Please note that tildes (~) in the message are interpreted as spaces.
Example
BEN TransparentBox 1 1 80 25 White Blue 1 Good~box!
BEN TransparentBox 10 10 20 20 Yellow Black 3 Great~box!
function that paints the region specified by (x1,y1) - (x2,y2) with the specified foreground and background colors. Text that are originally on the screen are not erased; they are just painted with a new color.
Example
BEN TransparentBox 1 1 80 25 White Blue
BEN TransparentBox 10 10 20 20 Yellow Black
BEN TransparentBox 4 4 8 8 9 2
Input Functions
The Input Functions menu is a submenu under the BEN
Functions
menu. All the functions under this menu can get input from the user: S
GetKey
GetKeyL
GetKeyU
GetLine
GetLineL
GetLineU
Menu
MenuF
MenuLCD
Ask Function
Syntax: Ask options
This is an input
function that waits for the user to press a key that is contained in the 'options' string. The option that the user selects is passed to the batch file as an errorlevel.
For instance, if the options string is ABCDE and the user presses the letter C on the keyboard, an errorlevel of 3 is returned (C is the third character of the string).
Example
@Echo Off
BEN Echo A. Format your hard drive.
BEN Echo B. Diskcopy a disk.
BEN Echo C. Run Windows.
BEN Echo D. Run DOSShell.
BEN Echo E. Play Sim City.
BEN Echo ~
BEN Echo Please make your selection.
BEN Ask ABCDE
If Errorlevel 5 If Not Errorlevel 6 Goto SimCity
If Errorlevel 4 If Not Errorlevel 5 DOSShell
If Errorlevel 3 If Not Errorlevel 4 C:\WIN\WIN
If Errorlevel 2 If Not Errorlevel 3 DiskCopy A: A:
If Errorlevel 1 If Not Errorlevel 2 Format C:
Goto End
:Simcity
CD\Simcity
Simcity
:End
GetKey Function
Syntax: GetKey |
This is an input
function that waits for the user to enter a key. This key is returned via the environment
variable
%BEN%. G
Example
BEN GetKey
BEN Echo You've pressed the %BEN% key!
GetKeyL Function
Syntax: GetKeyL
This is an input
function that waits for the user to enter a key. This key is converted into lowercase and returned via the environment
variable
%BEN%. H
Example
BEN GetKeyL
BEN Echo You've pressed the %BEN% key!
GetKeyU Function
Syntax: GetKeyU
This is an input
function that waits for the user to enter a key. This key is converted into uppercase and returned via the environment
variable
%BEN%. H
Example
BEN GetKeyU
BEN Echo You've pressed the %BEN% key!
GetLine Function
Syntax: GetLine
This is an input
function that waits for the user to enter a string. This string is returned via the environment
variable
%BEN%. ]
Example
BEN Echo What's your name?
BEN GetLine
BEN Echo So your name is %BEN%!
GetLineL Function
Syntax: GetLineL
This is an input
function that waits for the user to enter a string. This string is converted into lowercase and returned via the environment
variable
%BEN%. k
Example
BEN Echo What's your name?
BEN GetLineL
BEN Echo So your name is %BEN% in lowercase!
GetLineU Function
Syntax: GetLineU
This is an input
function that waits for the user to enter a string. This string is converted into uppercase and returned via the environment
variable
%BEN%. k
Example
BEN Echo What's your name?
BEN GetLineU
BEN Echo So your name is %BEN% in uppercase!
Menu Function
Syntax: Menu title choice1 [choice2 choice3...] C
This is an input
function that displays a menu on the screen. The choice that is selected by the user is passed back to the batch file as an errorlevel. For instance, if the user chooses choice #3, an errorlevel of 3 is returned. On the other hand, if the user opts to choose nothing, then an errorlevel of 0 is returned.
Please note that tildes (~) are interpreted as spaces, and no other function can be stacked after the Menu function is used. Also, use a minus sign (-) to tell BEN to display a blank line.
Example
@Echo Off
BEN Menu Please~make~a~selection: Format~your~hard~drive Diskcopy~a~disk Run~Windows Run~DOSShell Play~Simcity
If Errorlevel 5 Goto SimCity
If Errorlevel 4 Goto DOSShell
If Errorlevel 3 Goto Windows
If Errorlevel 2 Goto DiskCopy
If Errorlevel 1 Goto Format
BEN Echo You didn't make a selection!
Goto End
:Format
Format C:
Goto End
:DiskCopy
DiskCopy A: A:
Goto End
:Windows
C:\WIN\WIN
Goto End
:DOSShell
DOSShell
Goto End
:SimCity
CD\SimCity
SimCity
:End
MenuF Function
Syntax: MenuF filename C
This is an input
function that "runs" a menu designed by MDESIGN.
MenuLCD Function
Syntax: MenuLCD title choice1 [choice2 choice3...]
This is an input
function that works exactly like the menu
function, except that it displays the menu in black and white for increased legibility on LCD screens.
Message Functions
The Message Functions menu is a submenu under the BEN
Functions
menu. All the functions under this menu can display messages on the screen: -
Echo
List
Message
Write
WriteC
WriteV
Echo Function
Syntax: Echo message [message...]
This is a message
function that works like the DOS Echo function. Everything after the word Echo is displayed using the current writing color. Thus, no other functions can be stacked after Echo is used. T
If you wish to display a blank line, use the command "BEN Echo ~". If you wish to display more than one space between two words, use the tilde (~) as a separator instead. For example, if you want to display the words "Hello World, this is the computer speaking.", use the command "BEN Echo Hello~~~World, this is the computer speaking."
Example
BEN Echo Hello World!
BEN Echo This is a test!
BEN Echo ~
BEN Echo Hello~~~World, this is the computer speaking.
List Function
Syntax: List filename title
This is a message
function that acts as a file browser for the file specified by "filename". Tildes (~) in the title are interpreted as spaces. o
Example
BEN List C:\AUTOEXEC.BAT This~is~your~AUTOEXEC!
BEN List BEN.TXT You~are~reading~BEN.TXT!
Message Function
Syntax: Message line1 [line2 line3...] n
This is a message
function that pops up a message box onto the screen. Tildes (~) are interpreted as spaces. =
Example
BEN Message Hello~World! This~is~a~test!
This example will pop up this message box:
Hello World!
This is a test!
OK
Write Function
Syntax: Write foreground background message
This is a message
function that writes a string onto the screen using the specified foreground and background colors. Tildes (~) in the message are interpreted as spaces, and a semi-colon (;) at the end of the message tells BEN not to wrap to the next line.
Example
BEN Write LightRed Blue Hello~World!
BEN Write LightGreen Black This~is~a~test!;
BEN Write 7 1 Another~test!
WriteC Function
Syntax: WriteC foreground background message
This is a message
function that is similar in function as Write, but the message is centered between the two sides of the monitor.
Example
BEN WriteC LightRed Blue Hello~World!
BEN WriteC LightGreen Black This~is~a~test!;
BEN WriteC 7 1 Another~test!
WriteV Function
Syntax: WriteV x y foreground background message
This is a message
function that is similar in function as Write, but the message is written as a vertical column that starts from the position (x,y).
Example
BEN WriteV 1 1 Yellow Blue An~important~message
BEN WriteV 40 10 LightCyan Black Hello!
BEN WriteV 80 1 7 1 Great!!!
Music Functions
The Music Functions menu is a submenu under the BEN
Functions
menu. All the functions under this menu can create sound from the PC speaker:
Beep
Play
Sound
Beep Function
Syntax: Beep <
This is a music
function that simply creates a beep sound.
Example
BEN Beep
Play Function
Syntax: Play playstring
This is a music
function that plays music using the computer's speaker. The playstring is exactly the same in format as the BASIC Play statement. Here is a list of the music commands supported:
ML: legato (8/8 note length)
MN: normal music (7/8 note length)
Ln: length of notes (n=1-64; note length=1/n, eg. n=2 for
1/2 note)
Nn: Note number (n=0-84; 0 is a rest)
On: Octave (n=0-6, default 4)
Pn: Pause (n=1-64; pause length=1/n, eg. n=4 for 1/4 note)
Tn: Tempo (n=32-255, default 120; quarter notes per minute)
[: Move down an octave (min 0)
]: Move up an octave (max 6)
You can also use the actual letters of the notes (C, D, E, F, G, A, and B). These correspond to "do, re, mi, fa, so, la, ti". To play a scale, you should use "CDEFGAB]C".
The notes may be followed by dots, by note lengths, and by sharp or flat symbols (a '+' or '#' for a sharp, a '-' for a flat). For example, 'D-.' is a dotted D flat. The dot means that the note will play for half again its usual length. Dots can be repeated.
You can also use "<" for "[" and ">" for "]" in BEN data files that are read by BEN's T function. Don't use these in the command line however, because DOS will interpret them as redirection signs. If you use them, strange errors may occur. =
Example
BEN Play O5CDEFGFEDCP1CC
BEN Play ]EEEC
Sound Function
Syntax: Sound frequency duration
This is a music
function that uses the computer's speaker and produces a tone with the specified frequency for the specified duration. Frequency is measured in hertz and duration is measured in milliseconds. <
Example
BEN Sound 1000 1000
BEN Sound 2000 100
Screen Functions
The Screen Functions menu is a submenu under the BEN
Functions
menu. All the functions under this menu can control the properties of the screen: 7
Color
Cursor
EGAVGA
GetVideo
Locate
Scroll
Cls Function
Syntax: Cls background W
This is a screen
function that clears the screen with the specified background color. N
Example
BEN Color Yellow Blue
BEN Color White Red
BEN Color 7 1
Color Function
Syntax: Color foreground background y
This is a screen
function that changes the current writing color. ANSI.SYS must be loaded for this function to operate. N
Example
BEN Color Yellow Blue
BEN Color White Red
BEN Color 7 1
Cursor Function
Syntax: Cursor On/Off/Full/Half
This is a screen
function that changes the cursor shape. Use On for a normal cursor (_), Off for no cursor ( ), Full for a block cursor (
) and Half for a half-block cursor (
Example
BEN Cursor Off
BEN Cursor Full
EGAVGA Function
Syntax: EGAVGA On/Off
This is a screen
function that switches the EGA 43 / VGA 50 line mode on or off. If the EGA 43 / VGA 50 line mode is switched on successfully, an errorlevel of 2 is passed back to the batch file. Otherwise, an errorlevel of 1 is returned.
Example
@Echo Off
BEN EGAVGA On
If Errorlevel 2 Goto Success
BEN Echo Sorry. Your computer cannot display in
BEN Echo the EGA 43 or the VGA 50 line mode.
Goto End
:Success
BEN Cls Blue Color White Blue Locate 30 30
BEN Echo See how big your screen is!
BEN Locate 30 33
Pause
BEN EGAVGA Off
:End
BEN CleanUp
GetVideo Function
Syntax: GetVideo
This is a screen
function that finds out what kind of video system is installed. It returns the result in the environment
variable
%BEN%. :
The possible values that can be returned are as follows:
Mono: The computer has a monochrome system.
CGA: The computer has a CGA system.
EGA: The computer has an EGA system.
MCGA: The computer has a MCGA system.
VGA: The computer has a VGA system.
Unknown: Unknown video system detected.
Example
@Echo Off
BEN GetVideo
If "%BEN%"=="Mono" GOLF /Mono
If "%BEN%"=="CGA" GOLF /CGA
If "%BEN%"=="EGA" GOLF /EGA
If "%BEN%"=="MCGA" GOLF /MCGA
If "%BEN%"=="VGA" GOLF /VGA
This example shows a batch file that passes different parameters to the GOLF program (a game?) depending on what video system the computer has.
Locate Function
Syntax: Locate x y O
This is a screen
function that moves the screen cursor to the position (x,y). 5
Example
BEN Locate 1 1
BEN Locate 10 15
Scroll Function
Syntax: Scroll x1 y1 x2 y2 direction
This is a screen
function that scrolls the text enclosed in the (x1,y1)-(x2,y2) box. 'Direction' can be one of the following: UP, DOWN, LEFT, RIGHT. I
Example
BEN Scroll 1 1 80 25 UP
BEN Scroll 10 10 20 20 LEFT
Miscellaneous Functions
The Miscellaneous Functions menu is a submenu under the BEN
Functions
menu. All the functions under this menu are functions that do not belong to the other five menus: V
Cleanup
Delay
DirDisp
DirDispA
Extract
Flush
GetCD
Pause
Savepath
Shell
CleanUp Function
Syntax: CleanUp 9
This is a miscellaneous
function that does four things:
1. Changes the writing color to normal DOS color (same as
calling BEN Color
LightGray
Black).
2. Changes the cursor to a normal shape (same as calling
BEN Cursor
3. Erases all the environment
variables that have been
created by BEN (IE. %BEN%, %BEN2%, %BEN3%, etc.)
4. Restores the PATH if the SavePath function had been
called previously. (Please refer to the discussion on
the SavePath function.)
CleanUp should be called at the end of a batch file.
Example
BEN CleanUp
Delay Function
Syntax: Delay milliseconds
This is a miscellaneous
function that pauses the computer for the specified number of milliseconds. (1000 milliseconds = 1 second) 3
Example
BEN Delay 1000
BEN Delay 5000
DirDisp Function
Syntax: DirDisp directory
This is a miscellaneous
function that displays a file selection box and allows the user to select a file. The name of the selected file is stored into environment
variable
%BEN%. If the user presses ESC and opts not to choose any file, then %BEN% is set to contain nothing. 2
To have a greater control, use DirDispA instead.
Example
BEN DirDisp C:\
If "%BEN%"=="" Goto Chose_Nothing
BEN Echo You've chosen %BEN%!
Goto End
:Chose_Nothing
BEN Echo You didn't choose any file!
:End
DirDispA Function
Syntax: DirDispA directory filemask sortorder
This is a miscellaneous
function that is an advanced version of DirDisp. In addition to the starting directory, you can specify the file mask and the sorting order. %
'Filemask' specifies the types of file you want to display. For example, if you want to display only EXE files, you can use a filemask of "*.EXE". If you want to display both EXE and COM files, you can use a filemask of "*.EXE~*.COM" [different types of files are separated with tildes (~).] k
'Sortorder' specifies the order which DirDispA uses to display the files. It can be one of the following: [
NAME - Files sorted on names in ascending order.
EXTENSION - Files sorted on extensions in ascending
order.
TIME - Files sorted on time from the earliest to the
latest.
SIZE - Files sorted on size from the smallest to the
largest.
X - Files are unsorted.
You can also specify only the first letter of the sortorder you want. For example, instead of "BEN DirDispA C:\ *.* NAME", you can use "BEN DirDispA C:\ *.* N". This is not suggested, however, because it decreases the legibility of your batch file. i
Example
BEN DirDispA C:\ *.BAT~*.SYS~*.EXE EXTENSION
BEN Echo You've picked the file %BEN%!
Extract Function
Syntax: Extract source mask
This is a miscellaneous
function that extracts a certain part of a fully qualified filename (eg. the result from DirDisp or GetCD) and stores it into %BEN%.
'Source' specifies the source string from which you want to extract information. Usually, you should place an environment variable here.
'Mask' specifies the part of the selected filename you want BEN to return to you. It can contain one or more letters which define what BEN should put into %BEN%:
D - Returns only the drive part of the source (eg. C:)
P - Returns only the path part of the source without
the trailing backslash (eg. \TELECOM)
\ - Adds a trailing backslash to the path
N - Returns only the name part of the source
(eg. AUTOEXEC)
. - Adds a dot to the name
E - Returns only the extension part of the source (eg.
BAT)
Example
BEN DirDisp C:\TELECOM
SET SELECT=%BEN%
BEN Extract %SELECT% D
BEN Echo You've selected a file that is located in
drive %BEN%
BEN Extract %SELECT% P
BEN Echo This file has a path (without trailing
backslash) of %BEN%
BEN Extract %SELECT% P\
BEN Echo This file has a path (with trailing
backslash) of %BEN%
BEN Extract %SELECT% N
BEN Echo This file's name is %BEN%
BEN Extract %SELECT% E
BEN Echo And its extension is %BEN%
BEN Extract %SELECT% N.E
BEN Echo Its filename (name+extension) is %BEN%
BEN Extract %SELECT% P\N.E
BEN Echo Its path, name and extension is %BEN%
BEN Extract %SELECT% DP\N.E
BEN Echo This file's full name is %BEN%!
BEN Echo ~
BEN GetCD
BEN Extract %BEN% DRIVE
BEN Echo You're currently in %BEN% drive.
Flush Function
Syntax: Flush C
This is a miscellaneous
function that clears the keyboard buffer.
Example
BEN Flush
GetCD Function
Syntax: GetCD
This is a miscellaneous
function that finds out what the current directory is and stores it into the environment
variable
%BEN%. P
Example
BEN GetCD
BEN Echo Hey man, you're in the %BEN% directory!
Pause Function
Syntax: Pause Y
This is a miscellaneous
function that pauses the computer until the user presses a key.
Example
BEN Pause
SavePath Function
Syntax: SavePath
This is a miscellaneous
function that saves the PATH environment variable into a file called SAVEPATH.DAT (this file is stored in the current directory) and erases the PATH environment variable. Using this function can free up environment space so that BEN functions that make use of the environment (eg. GetLine) can function better. Remember to use the CleanUp function to restore the PATH upon the completion of the batch file.
Caution: Make sure that you don't change directory after
using SavePath. If you do, you must change back to
the directory where SavePath stores SAVEPATH.DAT
before you run CleanUp.
Example
@Echo Off
BEN SavePath
BEN Echo Your PATH has been saved!
BEN CleanUp
BEN Echo Your PATH is restored!
Shell Function
Syntax: Shell
This is a miscellaneous
function that "jumps to DOS". After this function is used, the user can work in DOS as long as he/she want. He/she can let the batch file regain control by typing EXIT.
Example
BEN Shell
T Function
Syntax: T filename
This is a miscellaneous
function that runs all the instructions in the data file. This lets BEN perform its jobs at a quicker speed.
The data file is just a normal text file (ASCII format). It can be created with any text editor, such as BENEDIT or the EDLIN or the EDIT programs included with DOS. The format of the text file is as follows: E
FUNCTIONS
FUNCTIONS
FUNCTIONS
FUNCTIONS
<End of File>
The FUNCTIONS are exactly the same functions as those that are ran from the command line. For example:
BEN T DATA.DAT
where DATA.DAT contains:
Box 1 1 80 25 Yellow Green 3
Pause
Cursor OFF
Cls Blue
<End of File>
is exactly the same as doing this:
BEN Box 1 1 80 25 Yellow Green 3
BEN Pause
BEN Cursor OFF
BEN Cls Blue
Usually, you should only use the T function when you have a large quantity of functions that you wish to be processed by BEN. >
Example
BEN T MYFILE.DAT
BEN T C:\BATCH\INSTRUCT
(DOS) menu
(Alt-D)
The DOS menu contains a number of commonly used DOS Batch functions. After selecting the wanted item, you will only need to answer a few questions and BENEdit will automatically insert the correct batch line into the current editing window. #
@Echo
For
Errorlevel
@Echo Off
BEN simply adds the line "@Echo Off" into the current editing window.
For
DOS provides a command called "For" to batch file writers. After choosing this item, you only need to fill in two criteria lines and BENEdit would create the necessary "For" line for you automatically. ?
Example: You want to "Type" out all the files ending in .BAT. (
In the first input line, enter "*.BAT" *
In the second input line, enter "Type *" -
BENEdit would automatically create the line "
"For %%v in (*.BAT) do Type %%v"
for you.
If Errorlevel
Many times, batch file writers need to check the errorlevel returned from a program (e.g., BEN). In many of these cases, he/she would find himself repeating many lines of statements:
If Errorlevel 4 If Not Errorlevel 5 . . .
If Errorlevel 3 If Not Errorlevel 4 . . .
If Errorlevel 2 If Not Errorlevel 3 . . .
By choosing this command, you can save yourself a lot of time by having BENEdit fill these lines for you.
Run
(Alt-R)
When you select Run, BENEdit will save and run the batch file in the current editing window. G
Note: select this option only when you are working with a batch file.
Help on Open a File Dialog Box
The Open a File dialog box contains an input box, a file
list, a file information panel, the standard button Cancel, one other action button (Open), plus a history list that's attached to the Name
inputbox.
Name
The Name input box is where you enter the name of the file to load, or the file-name mask to use as a filter for the Files list box (for example, *.BAT).
Files
INSTALL.BAT
C.BAT
QD.BAT
D.BAT
PRO.BAT
E.BAT
DIRR.BAT
F.BAT
G.BAT
..
W.BAT
\TRASH
A.BAT
\OTHERS
B.BAT
The Files list box lists the names of files in the current directory that match the file-name mask in the Name input box, plus the parent directory and all subdirectories.
C:\BATCH\QD.BAT
QD.BAT 342 Jul 14,1990 12:00pm
The File information panel shows the path name, file name, date, time, and size of the selected file. =
None of the items on this information panel are selectable.
[ Cancel ]
If you choose Cancel, nothing changes and no action occurs, and the dialog box is put away. M
(Esc always cancels a dialog box, even if a Cancel button does not appear.)
[ Open ]
In the Open a File dialog box, if you choose the Open button BENEdit opens a file and places the selected file in that window.
Help on the Change Directory dialog box
The Change Directory dialog box consists of an input box, a list box, the standard OK and Help buttons, and two other buttons (Chdir and Revert). |
Directory Name
The Directory Name input box is where you type in the path of the new directory.
Directory Tree
Drives
C:\
BATCH
TRASH
The Directory Tree list box enables you to navigate directories by using the selecting bar and pressing Enter.
If you're using the keyboard, press Enter to make the selected directory be the current directory, then choose OK or press Esc to exit the dialog box. +
[Chdir ]
The Chdir button changes the current directory once you've selected or typed in a directory name. +
[Revert]
The Revert button goes back to the previous directory, as long as you haven't yet exited the dialog box.
Help on the Find dialog box
The Find dialog box contains an input box with a history list, three sets of radio buttons, one group of check boxes, and the standard OK, Cancel, and Help buttons.
Text to Find
Enter the search string in the Text to Find
input box and choose OK to begin the search,
or choose Cancel to forget it.
Press the Down arrow key if you want to show
the history list associated with the input
box.
[X] Case sensitive
[X] Whole words only
[X] Regular expression
This group of check boxes governs the kind of
strings that BENEdit searches for.
Direction
) Forward
( ) Backward
Direction specifies which way you want BENEdit
to search, starting from the current cursor
position. Forward (from the current position
to the end of the file) is the default.
Scope
) Global
( ) Selected text
Scope determines how much of the file BENEdit
searches in. Global (entire file) is the default scope.
Origin
) From Cursor
( ) Entire Scope
Origin specifies where the search should
start.
Most components of the Replace dialog box are identical to those in the Find
dialog
box, except for the following additions:
New Text
Enter the replacement string in the New Text
input box.
You can also use the history list to the right
of the box to select a string you've used
previously.
[X] Case sensitive
[X] Whole words only
[X] Regular expression
[X] Prompt to Replace
This group of check boxes governs the kind of
strings that BENEdit searches for, and whether
the replacement is automatic.
[ Change All ]
Choose Change All if you want BENEdit to replace
all occurrences of the search string found, as
defined by the Direction, Scope, and Origin options.
BEN and Environment Variables
Several of BEN's functions (IE. GetKey, GetKeyU, GetLine, GetLineU, DirDisp, DirDispA, GetCD and GetVideo) return their results using environment variables. After you use any one of these functions, you can access the data that BEN returns by calling the variable %BEN%. Just put %BEN% in your batch file where you want the data to appear. For example, if you want to get the user's name and re-display it, you can do the following: e
BEN Write White Black Please~enter~your~name:~; GetLine
BEN Write White Black Your~name~is~%BEN%!
If you stack several functions that return data via environment variables, the first result would be stored into %BEN%, the second result into %BEN2%, the third into %BEN3%, and so on. For example, if you want to ask the user to enter two favorite colors and re-display them, you can do the following:
BEN Write White Black Enter~your~two~favorite~colors:
BEN GetLine GetLine
BEN Write White Black So~they~are:~%BEN%~and~%BEN2%!
Note: At the end of your batch file, you should make a call
to BEN's CleanUp function to erase all the variables
that BEN have created (IE %BEN%, %BEN2%, %BEN3%, etc.)