INIEDIT - Version 1.02 Copyright (C) Richard R. Sands CIS 70274,103 All rights reserved Documentation last updated September 9, 1991 OVERVIEW -------- If you often find yourself editing your WIN.INI, SYSTEM.INI, or any other 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. 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. This program is best used in a batch file, or with your favorite Menuing Program. SYSTEM REQUIREMENTS ------------------- Microsoft Windows 3.x INIEDIT has been tested with all DOS Versions 2.11 through 5.0. It's memory requirements depend on the size of your largest INI file (but limited to 4000 lines of text). 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. You may have more than 1 label on the command line. [options] are optional, and must be preceded with a "/" character. The options are: /? Displays version and help screen. /B- Disable backup files. Normally, INIEDIT will always backup your file up before making any edits. /D+ Enable "Debug" mode. This will display each line as it is executed with additional info so you can track down any errors in your logic. /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. /W+ Show warnings and wait for a key to proceed. This is off by default. Warnings are ususally available only in Debug Mode. 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: 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. EXIT Quit processing the script file 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 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:\AFTERDRK\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 parameter) INIEDIT WinBoot.Mod %1 %2 %3 (allow user to specify 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 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. 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, and mulitple user label parameters so you don't have to use SHIFT in your batch files. I've even had a request for an OS/2 version. 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= -------------------------------------------------------------------------- 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. The value entry is ignored. 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, vnetware.386, vipx.386 COMMENT Win [Clock] -------------------------------------------------------------------------- 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. NOTE: This is a hold-over from INIEDIT Version 1.01. It is best that you use COMMENT/UNCOMMENT rather than DELETE. 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 -------------------------------------------------------------------------- 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. 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 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 -------------------------------------------------------------------------- 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. The value entry is ignored. 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, vnetware.386, vipx.386 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-). 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. 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. LEGAL & REGISTRATION STUFF -------------------------- This program is supplied "As Is". I make no claims about the suitability of this software on your computer system. I cannot be held liable for any claims 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 (Version 1.02s). You may not modify the INIEDIT.EXE or INIEDIT.TXT files in any way. 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!). In return, you will get the latest copy of the program (with no reminder notices), laser printed documentation, and notification of new updates. You WILL get notified - I keep a database of all registered users. 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 (BB, CIS, Friend, etc) Your CIS number if applicable Thanks for your support! Rick Sands