home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
swCHIP 1991 January
/
swCHIP_95-1.bin
/
utility
/
grpini
/
nied20
/
iniedit.txt
< prev
Wrap
Text File
|
1995-12-09
|
25KB
|
782 lines
INIEDIT - Version 2.0
Copyright (C) 1991-1994 Richard R. Sands CIS 70274,103
All rights reserved
Documentation last updated April 15, 1994
OVERVIEW
If you often find yourself editing your WIN.INI, SYSTEM.INI, or any ther INI file before
you start Windows, then this program is for you!
INIEDIT provides batch file editing of your INI files so you can start up Windows with
mnemonic commands. This program reads a text file of editing commands that instruct it
to modify the various .INI files by section and keywords. You can change the contents of
a line, delete lines, comment, and uncomment them. You may include several labeled
sections in your INIEDIT script so you can have all of your various Windows
configurations in one text file.
Why did I write this program? I have a portable that, at work, is connected to a network,
at home it's not. When on the network, I have several utilities I need to load, and
although at home, they detect the lack of the network, I end up having to click a bunch of
OK buttons (This was worse in the Windows 3.0 days). I have customized system fonts
that I like to use, but as a programmer, I like to boot windows with the "standard" font to
check the dialog box metrics. Sometimes, I want to just start windows without having to
load up all my favorite utilities - get in quick - get out quick. I use different "shell"
programs depending on what "type" of environment I want to be in. You get the picture.
With INIEDIT all of these actions are easily (read I-Don't-Have-To-Remember-
Anything) written into a menu or batch file.
Over time, IniEdit has evolved into a very useful Windows On Network utility. By using
environment variables and IniEdit, Windows can be configured on the fly.
This program is best used in a batch file, or with your favorite Menuing Program.
SYSTEM REQUIREMENTS
Microsoft Windows 3.0 or 3.1
INIEDIT has been tested with all DOS Versions 2.11 through 6.02. It's memory
requirements depend on the size of your largest INI file (but limited to 4000 lines of text
or your available memory).
STARTING INIEDIT
IniEdit requires at least 1 parameter: The Script Filename. This is a normal ascii file that
contains the commands you want to be executed.
In addition you may place some Switch Options that modify the way INIEDIT behaves.
The formal syntax for starting INIEDIT is as follows:
INIEDIT <-- This will display version & help screen
or
INIEDIT filename.ext [labels] [options]
where
filename.ext
is the name of the text file that contains your editing commands.
[labels]
are optional. A label designates one or more sections of your
INIEDIT script to be executed. Yu may have more than 1 label on
the command line.
[options]
are optional, and must be preceded with a "/" character.
The [options] are defined as
/?
Displays version and help screen.
/B-
Disable backup files. Normally, INIEDIT will always backup your
file up before making any edits.
/C+
Clears the screen when execution starts.
/D+
Enable "Debug" mode. This will display each line as it is executed
with additional information so you can track down any errors in your
(or my) logic. When debug mode is on, then after each statement is
displayed, the message "Press any key..." is displayed.
/L+
Show a list of all labels found in the INIEDIT script file. This is
useful if your file requires a user-label entered on the command line.
Your batch file can check for a parameter, and if not found then issue
this switch. This switch returns a DOS Errorlevel of 1.
/P-
Don't pause for a key when an error occurs. This is on by default.
You can check for errors in your batch file with the DOS errorlevel
variable.
/Q+
Quiet execution, this will not display any error messages. The DOS
ErrorLevel is still set to indicated.
/W+
Show warnings and wait for a key to proceed. This is off by default.
Warnings are ususally available only in Debug Mode.
The special combination of "/D+ /P-" will show debug code, but not pause for a key to be
pressed.
EDITING COMMANDS
All commands to INIEDIT are entered into a regular ascii text file created with your
favorite TEXT editor (or WP w/Text Out).
There are six basic commands:
APPEND
Adds a keyword to the section regardless
if it exists
COMMENT
This will make a keyword entry into a
comment.
DELETE
This can delete a whole section or just one
keyword.
EDIT
This will change the contents of a
keyword entry.
INI
Opens an .INI file for editing
UNCOMMENT
This changes a commented line into a
regular line.
Each command is written on it's own line. Lines may not wrap, but may be up to 255
characters (including leading blanks) long. For each command, you may write the whole
command (eg. COMMENT) or just the first three letters (eg. COM).
For all commands except ECHO, EXIT and INI, the syntax is identical. You include the
command, the DOS Ini filename (path & .ext not required), the section name enclosed in
square brackets, and, the keyword/value pair separated with an equal sign ("=").
For example:
EDIT WIN [Windows] Beep=No
This command will change the BEEP keyword under the [Windows] section of the
WIN.INI file to NO.
Comments are lines starting with a semi-colon. The line does not have to start in column
one. Comments must be on their own line. This is a remark in the INIEDIT script file:
; This is a valid remark
Labels are used to "tag" sections of the INIEDIT script to be used with a parameter sent
from the command line. This way you can have several different configurations without
having to have them in separate files (as in INIEDIT Version 1.01). Given a INIEDIT
script with these two sections:
; This is TEST.MOD (the .MOD means MODifications)
:FAST
EDIT Win Load=
EDIT Win Run=
EXIT
:SLOW
EDIT Win Load=C:\AFTRK\AD NWSEND EMAIL RESGUAGE BIGDESK
EDIT Win Run=SkeyWin YaClock
EXIT
Then having your batch file (or Menu) give this command:
INIEDIT Test.Mod SLOW
Will execute the section listed under ":SLOW" and this command:
INIEDIT test.mod fast
would execute the section listed under ":FAST". Note the EXIT commands at the end of
each section. If you don't have one, it will "fall" through to the next section (which could
be construed as a feature!).
You can place more than one label on the command line. This has the effect of executing
each section. This command will execute two sections:
INIEDIT test.mod slow fast
You may also have descriptions attached to your labels. This is very useful when the
Show Labels switch is used (/L+):
:FAST - Don't load any utilities
:SLOW - Load all utilities
There are no flow-control statements. The sequence of execution is essentially linear. I
was tempted to put in a CALL/GOTO command but I found it -really- wasn't needed. So
far, no one has complained. If you can give me a good situation where you would want
one, I'll consider it for the next release.
A MOMENT OF REFLECTION
As I wrote this program, I considered adding commands for creating and executing some
kind of menu system. After some reflection, I decided that the last thing the world needs
is a new menu system. If you really need one, I can provide a simple DOS Batch File
based system with color, nested menus, etc. with all commands using regular batch file
commands and one small utility. Again, if you think there is an overriding reason for
including these type of commands let me know and I'll consider it for the next release.
COMMAND ABBREVIATIONS
INIEDIT Version 1.01 allowed the first three characters of the command to be used rather
than the whole command (eg. COM for COMMENT). This is still enabled, but in lieu of
future versions, you are encouraged to use the whole command.
SAMPLE BATCH FILES
This batch file will start Windows after modifying the various INI files that I need. It
first checks for no parameters, and if none, displays all the labels in the file. Otherwise it
executes the INIEDIT program and checks for any errors. If no errors then windows is
started.
@Echo Off
C:
cd C:\WIN
if %1!==! GOTO Error (check for required params)
INIEDIT WinBoot.Mod %1 %2 %3 (allow user labels)
if ERRORLEVEL 1 GOTO Done (check for any errors)
Win (start Windows)
GOTO Done (and quit)
:Error
INIEDIT WinBoot.Mod /L+ (display list of labels)
:Done
Alternatively, I prefer the following batch file since it allows me to set the Windows
initialization I want by giving the INIEDIT command but until I need to change the
Windows startup, I just type WIN.
For example:
@Echo Off
C:
cd C:\WIN
if %1!==! GOTO Windows (no params, just execute win)
INIEDIT WinBoot.Mod %1 %2 %3 (allow user labels)
if ERRORLEVEL 1 GOTO Done (check for any errors)
:Windows
Win (start Windows)
:Done
THE FUTURE OF INIEDIT
I don't think INI files are going to go away, so this program should be useful for the next
few versions of Windows, although it may not be needed on
Some suggestions that I have not implemented (yet) are some control commands (eg.
GOTO or CALL), some substring handling for modifing portions of a keyword (eg.
remove "clock" from LOAD=Calc Clock Bye), some screen handling commands for
creating prompts/menus,
I've even had a request for an OS/2 version, though it looks that it wonÆt happen.
Depending on additional interest, these types of commands, or other commands could
very well appear on future releases of INIEDIT.
COMMAND REFERENCE
Manual Conventions
Because the use of the [] symbols to denote sections, I will write required values in
uppercase.
EDIT win [section] KEYWORD=value
All keywords must have an equal sign after them even if nothing follows.
EDIT Win [Windows] Run=
APPEND
APPEND ini [section] KEYWORD=value
Appends (or adds) the contents of the keyword under the [section] heading. If no
[section] is provided, then it appends the keyword to the first section that keyword
appears under. Otherwise, it appends the keyword after the last keyword matching in the
section.
This is provided mostly to handle adding new DEVICE entries in the SYSTEM.INI file.
To edit these kind of entries, you need to first try to delete the keyword, then append it:
INI System
DELETE [386Enh] DEVICE = vnetware.drv
APPEND [386Enh] DEVICE = v3com.drv
APPEND will not add duplicate lines. I cannot think of any reason why any
keyword=value" would be duplicated exactly.
While in debug mode (/D+) you may see "warnings" like "keyword not found". These
are "soft" errors, INIEDIT will add the keyword AND section if it does not exist.
NOTE: The "value" portion of the syntax may contain references to the DOS
environment ala batch file syntax: eg. %NETNAME% would look up the variable
"NETNAME" and substitute the text on the right side for it. If
NETNAME=RICKS then the RICKS gets substituted for %NETNAME%
whenever it is encountered. See DOS ENVIRONMENT VARIABLES in your
favorite DOS how-to manuals.
Example:
APPEND system [386Enh] device=special.drv
CLS
CLS
Clears the screen.
Examples:
CLS
COMMENT
COMMENT ini [section] KEYWORD=value
Changes the section/line containing the keyword to be a comment. This is a non-
destructive way of "deleting" keyword entries. If the VALUE entry is present, then an
exact match made. This is useful when using COMMENT with the "device" keywords in
the SYSTEM.INI file since there are multiple occurences of this keyword.
If no [section] is provided, then it changes the value of the first keyword under -any-
section that matches. See the EDIT entry.
Keywords not found are "soft" errors and ignored by INIEDIT.
Examples:
COMMENT System [boot.description] network.drv=
COMMENT System [386Enh] network=*vnetbios, netware.386
COMMENT Win [Clock]
DEBUG
DEBUG any text at all
Display text to the screen while in debug mode. This is identical to the ECHO command
except the output is only displayed when the /D+ command line parameter is used to turn
on debug mode.
A DEBUG command by itself, just writes a blank line.
Examples:
Debug Please wait, modifing WIN.INI
Debug Please wait, modifying SYSTEM.INI
Debug
DELETE
DELETE ini [SECTION] KEYWORD=value
Deletes a keyword from the active ini file. If the keyword is not given, then it deletes the
whole section from the ini file. Note that you must supply [section] AND/OR keyword.
If you supply a value entry, then an exact match is performed. This is useful for the
SYSTEM.INI's device= values which can appear more than once in each section.
NOTE: This is a hold-over from INIEDIT Version 1.01. It is best that you use
COMMENT/UNCOMMENT rather than DELETE. However, I will continue to
keep this command.
If no [section] is provided, then it changes the value of the first keyword under -any-
section that matches. See the EDIT entry.
Examples:
DELETE Win [Clock]
DELETE Win [Clock] iFormat=
DELETE Win [Clock] iFormat=1
DELETE Win iFormat=1
DOS
DOS command
This command will execute a command shell. You may run a batch file or .COM or
.EXE program. This command is meant to perform basic operating system commands
and not anything fancy.
NOTE: You must not run any kind of TSR. This includes network shells.
Examples:
DOS del *.bak
DOS copy x:\net\default.ini c:\windows\ccmail.ini
DOS user.bat
ECHO
ECHO any text at all
Display all text following ECHO and performs a carriage-return linefeed. This is
provided for optionally notifying the user while long edit commands are being executed.
An ECHO command by itself, just writes a blank line.
Examples:
Echo Please wait, modifing WIN.INI
Echo Please wait, modifying SYSTEM.INI
Echo
EDIT
EDIT ini [section] KEYWORD=value
Changes (or adds) the contents of the keyword under the [section] heading. If no
section] is provided, then it changes the value of the first keyword under -any- section
that matches. You might be safe saying:
EDIT Win Load=Clock
But you might have problems with a command like:
EDIT Win iFormat=0
Because several programs use the iFormat keyword, and you could be sure that the
iFormat you meant was changed. It would be better to write a statement like:
EDIT win [Clock] iFormat=0
While in debug mode (/D+) you may see "warnings" like "keyword not found". These
are "soft" errors, INIEDIT will add the keyword AND section if it does not exist.
NOTE: If you are trying to change the value of a keyword that appears more than once
in a section (eg. SYSTEM.INI's DEVICE keywords) then this command will only
edit the first item. You should use COMMENT and UNCOMMENT to change
those types of entries.
NOTE: The "value" portion of the syntax may contain references to the DOS
environment ala batch file syntax: eg. %NETNAME% would look up the variable
"NETNAME" and substitute the text on the right side for it. If
NETNAME=RICKS then the RICKS gets substituted for %NETNAME%
whenever it is encountered. There are no errors reported if the %VAR% is not
found.
Examples:
EDIT system [boot] shell=msdos.exe
EDIT win [desktop] WallPaper=G:\BITMAPS\MMONROE.BMP
EXIT
EXIT
Terminates the execution of the script.
This is typically used when you want only a certain portion of a script to be executed.
Script sections always have a label to designate the section (except, possibly, for the first
section).
EXIT is not required if the section is the last section in the file.
Example:
:Label1
edit win [clock] iformat = 1
EXIT
:Label2
edit win [clock] iformat = 0
INI
INI filename
Opens an .INI file for editing.
This is typically used at the start of a section. It is an optional command since you can
include the INI file on the line of each command.
Example:
:Label1
INI Win
edit [clock] iformat = 1
edit [desktop] WallPaper = Cube.Bmp
EXIT
NEW
NEW filename
Creates a new .INI file for editing.
This is must be used at the start of a section. This creates a new INI file that contains no
lines. You may use APPEND and EDIT to add lines to the file. The file is not written if
there were no edits performed so no zero byte files will be created.
Example:
:Label1
NEW netware
edit hotkey=F12
EXIT
TURN
TURN flag = ON | OFF
Script method of setting a command line switch.
These will allow the script to override the command line settings. A value of ON is the
same as the + command, and the OFF value is equal to the - command.
The valid flags are:
QUIET same as /Q
DEBUG same as /D
PAUSE same as /P
BACKUP same as /B
WARNINGS same as /W
Example:
:Label1
TURN debug = on
TURN pause = off
UNCOMMENT
UNCOMMENT ini [section] KEYWORD=value
Changes the commented line or section containing the section/keyword to be an active
statement. This is the compliment of the COMMENT command. If the VALUE entry is
present, then an exact match made. This is useful when using COMMENT with the
"device" keywords in the SYSTEM.INI file since there are multiple occurences of this
keyword.
If no [section] is provided, then it changes the value of the first keyword under -any-
section that matches. See the EDIT entry.
Keywords not found are "soft" errors and ignored by INIEDIT.
Examples:
UNCOMMENT System [boot.description] network.drv=
UNCOMMENT System [386Enh] network=*vnetbios
UNCOMMENT Win [Clock]
ERROR MESSAGES
There are two levels of errors: Soft and Hard. Soft errors are warnings. Soft errors are
(ususally) ignored during normal execution of the program, they are only reported during
Debug Mode (/D+) or if you have the Show Warnings switch (/W+) active. They do not
stop the program. Hard errors will stop the program and won't make any changes to the
current INI file. If a Hard Error occurs, then the program will wait for a key to be pressed
unless the user has specified No Pause On Error (/P-).
Entry Already Exists: [section] keyword=value
This is reported by the APPEND command. This merely means that the target
line already is present.
Exact Match to "[Section] Keyword=Value" not found
This is reported as a warning by COMMENT/UNCOMMENT if an exact match
is specified but not found.
File not found: d:\path\filename.INI
Attempt to open an .INI file that does not exist. Check the path of the filename
and spelling.
File not open: d:\path\filename.INI
An attempt was made to write an INI file that was not opened. Check the path of
the filename and spelling.
Label "xxxx" not found
A label parameter supplied on the command line was not included in the INIEDIT
script file.
No INI file opened!
A command is about to be executed (any command but EXIT) and there is no INI
file opened. Include the INI filename, at least, on the first statement of each
section.
Parameter file not found: d:\path\filename.ext
This means you gave an incorrect filename to be used as the INIEDIT script.
INIEDIT makes no assumptions about the file extension you used. Also, check
the path of the filename.
Too many lines in d:\path\filename.INI
The INI file you have tried to edit has grown too large. INIEDIT can only edit
files up to 4000 lines long. (If you have a INI file that gets this error, I'd like to
see it!)
Too many user parameters
You are allowed 15 "User Parameters" to the INIEDIT program. I think this
should be sufficient for 99% of all uses<g>.
Unknown identifier: xxx
An unknown command has been encountered in the INIEDIT script file. Check
your spelling.
Unknown Switch: /x
You have included a switch that INIEDIT does not understand on the command
line. Check your batch file / Menu.
You must include a filename
You must include a filename on the command line to INIEDIT. INIEDIT does
not make any assumptions about what file extension you have used.
Runtime Errors 200-203
These are Turbo Pascal errors and generally mean you have run out of memory
for the program's data. This should not happen if you are going into Windows. If
it does, it would me that you really don't have enough memory to go into
Windows. Check and make sure that you are not "shelled" out of another
program.
INIEDIT HISTORY
Version 2.0 - April 15, 1994
* Fixed error reported regarding readonly script files on local drives.
Fixed error reported that %var% did not work in INI statement
Created CLS, DEBUG, DOS, NEW, and TURN commands
Version 1.09 - Feb. 7, 1994
* Now allows long keyword identifiers (up to 128 chars!) to support Swiss
WordPerfect keywords.
* Fixed a bug with multiple assignments (eg. keyword=AB=CD=DE)
Version 1.08 - August 30, 1993
* Functionally identical to 1.07, except that registration procedures have been
changed to make it more convientient for the user. Rereleased on
CompuServe.
* Added the /Q+ command line parameter
Version 1.07 - July 22, 1993 - User Suggested
* Added %ENV-VAR% syntax to the VALUE part of any statement. Picks up
the value from the DOS environment.
Version 1.06 - April 15, 1992 - User Reported
* Bug fix: Exit reported an error if no INI file was edited and the program
exited.
Version 1.05 - January 2, 1992 - User Suggested
* Made clear screen command at startup switch controlled (/C+)
* Made /P- effect /D+
* Fixed bug with small keywords names that were substrings of larger
keywords. eg. abc= and abcde= were both considered the same.
* Added an ECHO command so users can be notified of lengthy processes.
Version 1.04 Nov. 17, 1991 - User Suggested
* Added: APPEND command
Version 1.03 Sept. 17, 1991 - User Found
* Bug Fix: DELETE, COMMENT, and UNCOMMENT performed their action
only on the first keyword in the section. This error occured only when a
section had multiple entries with the same keyword.
Version 1.02 Sept. 4, 1991
* Added some features:
* Multiple files combined into one via labels
* EXIT command
* Long command names for clarity
* Released as shareware on CompuServe 09/09/91
Version 1.01 March 1991
* Released for use at MCGNW, Inc.
LEGAL & REGISTRATION STUFF
This program is supplied "As Is". I make no claims about the suitability of this software
on your computer system. I have made my best effort to keep bugs to a minimum. I
cannot be held liable for any claims I've made that are not supported (bugs) nor for any
misuse of this program, nor for any damage that may result of using this program.
You may freely distribute the INIEDIT.EXE and INIEDIT.TXT files as long as
INIEDIT.EXE is unregistered. You may not modify any of the INIEDIT files.
This is User-Supported software. A lot of work went into writing this package. If you
find this program useful, please send us $20.00 per copy or $100 per 10 copies (other
deals can be made!). Please send checks only, I cannot accept Credit Card orders. In
return, you will get the latest copy of the program, information to allow you to add your
name to the program and disable the "nag" screens, and documentation in Microsoft
Word 2.0 and Rich Text file formats.
Updates are available by request. Any newer version downloaded from CompuServe is
automatically registered without having to go through me - See your licensing
instructions.
CORPORATE USERS - IF YOU CONTINUE TO USE INIEDIT, YOU MUST
HAVE A FULLY REGISTERED VERSION - AN UNLIMITED-USER SITE
LICENSE IS AVAILABLE.
Whether you are registered or not, I am wide open to any enhancements you might offer,
bug reports (not MY programs!), or any comments about anything at all. Best way to do
this is to Mail me via CIS.
Please send check to
Richard Sands
P.O. Box 3917
Portland, Oregon 97208
Please include the following information with your order:
Your Name
Your Address
The Registration Name (eg. Company, Department, or Name)
Where you found the program (BBS, CIS, Shareware Publ., Friend, etc)
Your CIS number if applicable
Disk Size (3.5 or 5.25) All are high density
Thanks for your support!
-Rick Sands
<end>
InitEdit Documentation 04/15/94 Page 27