INITYME

Prev Next Home Home Table Of Contents Index

INITYME.EXE - Modifies Windows INI Files

Download:
INITYME.ZIP

IniTyme is a Windows *.INI file manipulator. It is designed to assist the network administrator who has to maintain INI files for many users.

USAGE: INITYME ChangeFile IniFile [/Q]


       or MARXMENU INITYME ChangeFile IniFile

Note: If you are running IniTyme from MarxMenu rather that INITYME.EXE, then all references to running INITYME are really MARXMENU INITYME.

The /Q switch puts IniTyme in Quiet mode. No messages to the screen are displayed.

Example:


  INITYME CHANGE.INI SYSTEM.INI

In the above example CHANGE.INI is the control file that will control the changes that will be written to the target file SYSTEM.INI. You can also invoke IniTyme by passing only one parameter. If you pass only one parameter, then the extension DEF or CTL are assumed for the name of the change file.

Example:


  INITYME SYSTEM.INI
  (SYSTEM.DEF or SYSTEM.CTL are assumed)

The ChangeFile is formatted like an INI file. A sample changefile might look like this:


    ; CHANGE.INI : A sample changefile for the IniTyme Program.

subst 'C:\WINDOWS\PM4\' 'W:\PM4'

[boot] del sound.drv ;deletes a line

del [keyboard] ;deletes a section

[386Enh] Paging=1 Device=mydev.386 foo=bar ADD TestMode=3 CHANGE mydevice=mydriver.386

[fonts] subst 'V:\' 'P:\WINDOWS\'

Any line that starts with the semicolon is a comment and will not be processed.

Adding and updating lines is done by listing the new lines as you wish them to appear. In the example there is a line in the [386ENH] group that reads PAGING=1. If the target INI files does not contain a [386ENH] group it will be created. The default mode is - change it if it's there, add it if it's not.

If that group does not contain a PAGING=1 line it will be added to the group. If a line in the [386ENH] group already exists that sets PAGING=2 it will be changed to PAGING=1. The word DEVICE= is a special case if it is found in the [386Enh] section and it is automatically added unless the whole line matches something that's already there.

ADD ---

Using the word ADD in front of the line causes the line to be added if it isn't already there, but not changed if it is already there. (Add but don't change.)

CHANGE ------

Using the word CHANGE in front of the line causes the line to be changed if it is there, but not added if it isn't there. (Change but don't add.)

DEL ---

Using the word DEL in front of the line causes a matching line to be deleted from the INI file. The DEL command can also be used to remove entire groups as illustrated in the example line DEL [KEYBOARD].

ADDITEM -------

When using commands like Run=Prog1 Prog2 Prog3 you might want to add more items to the list. If you change file contains: "AddItem Run=Prog4 Prog5" then the result will be "Run=Prog1 Prog2 Prog3 Prog4 Prog5"

DELITEM -------

Similar to AddItem, DelItem removes items form a list. If your INI file contains "Run=Prog1 Prog2 Prog3 Prog4" and your change INI file contains "DelItem Run=Prog2 Prog4" then the result will be: "Run=Prog1 Prog3"

ADDITEMCOMMA DELITEMCOMMA -------------------------

Same as AddItem and DelItem except the items are separated by a comma and a space.

WRITE / WRITELN ---------------

Write writes a message to the screen. It can be used as a tool for debugging change files. Writeln writes the line with a carriage return and linefeed. Write does not.


Example:
Writeln 'Made it Here!' Writeln 5 + 3 ' ' ReadEnv 'temp'

ADDVALUE -------- If a line is found, AddValue will add (or subtract for negative values) the amount of the line in the change file.


Example:
Original file has: NumValue=9 Change file has: AddValue NumValue=3 Result file will have: NumValue=12

AFTER -----

If you use the command AFTER <line> then the next item that is added or changed will be put after the line you specified. If the line you specified isn't found then it is added to the end of the section. The after command can also be used to move a line from one place to another within the same section.


Example:
After Run Foo=Bar

BEFORE ------ Before is just like after except it adds the line before the specified line.

FIRST -----

If you use the word first, then the next item added will be first in the section.

SUBST -----

The SUBST command is used to replace strings within an INI file. It can be used in two fashions either globally throughout the file or locally within a group. In the above example it is used both ways.

Putting the line SUBST 'C:\WINDOWS\PM4\' 'W:\PM4' before the first group header will cause the path string 'C:\WINDOWS\PM4\' to be globally replaced throughout the file with 'W:\PM4'. In the last line of the above example the SUBST 'V:\' 'P:\WINDOWS\' command will replace only those strings that match in the group [fonts].

The SUBST command also supports references to environment variables. Thus F:\HOME\%USER%\WINDOWS becomes F:\HOME\MARC\WINDOWS.

INITYME also has special provisions for handling the [GROUPS] section on the PROGMAN.INI. This section numbers the groups that are referenced. INITYME will scan the groups listed and determine the first available group number when it is adding to the [GROUPS] group.

To illustrate, if the PROGMAN.INI files group section reads as follows:


    [Groups]
    Group1=H:\WINDOWS\MAIN.GRP
    Group2=H:\WINDOWS\ACCESSOR.GRP
    Group4=H:\WINDOWS\STARTUP.GRP
    Group5=H:\WINDOWS\BP7.GRP
    Group6=H:\WINDOWS\ALDUS.GRP
    Group7=F:\HOME\MARC\WINDOWS\WORDFORW.GRP
    Group8=F:\HOME\MARC\WINDOWS\MICROSOF.GRP
    Group3=F:\HOME\MARC\WINDOWS\EDOS.GRP

and your ChangeFile contains:


    [Groups]
    DEL group=BP7.GRP
    Group=MAIN.GRP
    Group=MYGROUP.GRP
    DEL group=EDOS.GRP
    Group=Z:\SYSTEM\TEST.GRP
    Group=MASTER.GRP

After executing IniTyme your PROGMAN.INI group section would now read:


    [Groups]
    Group1=MAIN.GRP
    Group2=H:\WINDOWS\ACCESSOR.GRP
    Group4=H:\WINDOWS\STARTUP.GRP
    Group6=H:\WINDOWS\ALDUS.GRP
    Group7=F:\HOME\MARC\WINDOWS\WORDFORW.GRP
    Group8=F:\HOME\MARC\WINDOWS\MICROSOF.GRP
    Group5=MYGROUP.GRP
    Group3=Z:\SYSTEM\TEST.GRP
    Group9=MASTER.GRP

If new groups are added, the Order= line in the [Settings] section is updated.

DUPLICATES ---------- Most key words in INI files are unique, with the notable exception of the Device= keyword in the [386enh] section. IniTyme allows you to specify other keywords that are allowed to be duplicated. Duplicates are specified at the top of the file before any sections are defined.


Example:
Duplicates Device=[386enh] ;default Duplicates Dups=[Section]

You can also specify duplicates for all sections by specifying the section name [*].


Example:
Duplicates Dups=[*]

CLEANNOEQUALS ------------- The CleanNoEquals command tells IniTyme to remove lines that do not cantain an = sign. This is used to automatically clean up damaged INI files.

CLEANEMPTYSECTIONS ------------------ The CleanEmptySections command is used to remove sections that contain no lines.

CONDITIONALS ------------

IniTyme supports conditional changes. If the condition is met then the changes are made. If statements can be nested.


 if [condition]
    Device=mydev.386
    add foo=bar
 else
    Device=otherdev.386
    change foo=notbar
 endif

CONDITIONAL LIBRARY -------------------

And Returns the logical And of two values.


Example:
if InGroup 'EveryOne' and InGroup 'Accounting'

Or Returns the logical Or of two values.


Example:
if InGroup 'EveryOne' or InGroup 'Accounting'

Xor Returns the logical Xor of two values.


Example:
if InGroup 'EveryOne' Xor InGroup 'Accounting'

Not Returns the logical Not of a value.


Example:
if Not InGroup 'EveryOne'

+ Adds two values.


Example:
if 'A' + 'B' = 'AB'

- Subtracts two values.


Example:
if 5 - 3 < 4

= Compares two values and returns true if they are equal.


Example:
if 2 + 2 = 4

<> Compares two values and returns true if they are not equal.


Example:
if 2 + 2 <> 5

> Compares two values and returns true if the first value is greater than the second value.


Example:
if 'D' > 'C'

< Compares two values and returns true if the first value is less than the second value.


Example:
if 'C' < 'D'

>= Compares two values and returns true if the first value is greater than or equal to the second value.


Example:
if 'D' >= 'C'

<= Compares two values and returns true if the first value is less than or equal to the second value.


Example:
if 'C' <= 'D'

( ) Parens begin and end logical grouping for interpretation.


Example:
if ('A' < 'B') and (9 > (5 + 3))

True Returns the logical value True


Example:
if True

False Returns the logical value False


Example:
if not False

ReadEnv (Environment String) Returns the value of an environment variable.


Example:
if ReadEnv 'ENHANCED' = 'Y'

ValueOf Return the value of an element in the current section.


Example:
if ValueOf 'PagingDrive' <> 'H' PagingDrive=C endif

Value (String) Return the numeric value of a string.


Example:
if Value(ValueOf CachedFileHandles) < 12 CachedFileHandles=20 endif

UpperCase Returns the UpperCase of a string.


Example:
if UpperCase ReadEnv 'ENHANCED' = 'Y'

CPU Returns the class of CPU chip you are running.


Example:
if CPU >= 3

MathChip Returns true if you have a math coprocessor.


Example:
if MathChip

Display Returns the type of video card. Types returned are HERC, CGA, EGA, VGA.


Example:
if Display = 'VGA'

InGroup (Group) Returns True if user is in the Novell group.


Example:
if InGroup 'EveryOne'

If you are not running on Novell, you can set an environment variable and list the groups there.

Set Groups=Everyone,Accounting,Sales

InMem (TSR) Returns True if the TSR is in memory. It can also detect the names of pending batch files that are running.


Example:
if InMem 'IPXODI' if InMem 'AUTOEXEC'

ExistFile (Name) Returns True if the file exists.


Example:
if ExistFile 'C:\WINDOWS\SOL.EXE'

ExistDir (Name) Returns True if the directory exists.


Example:
if ExistDir 'C:\WINDOWS'

ShellLoaded Returns True if the Novell VLM or NetX shell is loaded.


Example:
if ShellLoaded

VlmLoaded Returns True if the Novell VLM shell is loaded.


Example:
if VlmLoaded

Station Returns the workstation address on a Novell network or the value set in the environment variable STATION=.


Example:
if Station = '250:33333'

UserName Returns the Novell login name of the user, or the value set in the environment variable USER=.


Example:
if UserName = 'Marc'

DayOfWeek Returns the first three letters of the day of the week.


Example:
if DayOfWeek = 'TUE'

Month Returns the first three letters of the Month.


Example:
if Month = 'AUG'

INIMAN COMPATIBILITY -------------------- In order to make IniTyme more compatible with the popular IniMan program from Saber Software, (which is now McAfee) I've added several new conditionals and some syntax enhancements. Because of differences in the design of these two programs, IniTyme is not 100% compatible with IniMan's DEF files. But, these additions are a step in that direction, and makes the transition significantly easier.

IniTyme will search for DEF files in the current directory and the directory pointed to by the S_CONFIG environment variable.

Unlike IniTyme, IniMan uses ";*" as a keyword for it's conditionals. IniTyme supports ;* for compatibility, but when given the choice, IniTyme's more powerful IF should be used. The ;* works like the word IF, but it uses the rules of IniMan instead. IniMan's ;* and IniTyme's IF statements can be freely mixed. IF statements can be nested.

IniMan conditionals can be easilly converted to IniTyme conditionals as follows:

IniMan:


  ;*Groups=Everyone
  Line1=1

IniTyme:


  if Groups=Everyone
     Line1=1
  endif

IniMan:


  ;*Groups=Everyone
  ;*begin
  Line1=1
  Line2=2
  ;*end

IniTyme:


  if Groups=Everyone
     Line1=1
     Line2=2
  endif

One difference between IniMan and IniTyme is if the conditional is not true, IniMan will delete the line. Inityme will do nothing to the line unless you specify it specifically in an else statement. Since IniTyme has the DEL command, you get more specific control over what you can do. If you want a line to be deleted if the condition is not met, you would do as follows:


  if Groups=Everyone
     Line1=1
  else
     Del Line1=
  endif

Another difference between IniMan and IniTyme is that IniMan will not change a line if it already exists. IniTyme will change the line. If you want a command to behave like IniMan, do this:


  Add Line1=1

The word ADD tells IniTyme to add the line if it doesn't exist, but not to change it if it does.

IniMan conditionals don't require quotes around strings, so quotes can be used optionally.

If multiple conditions are specified without the use of AND, OR, or XOR; then AND is assumed.


Example:
;*Groups=Accounting,Sales Users=!Marc

In the above example, the condition is True only if both conditions are met. If you want it to be True if either condition is met, then you will do the following:


Example:
;*Groups=Accounting,Sales or Users=Marc,Grace

IniTyme also supports the IniMan Not symbol "!". If "!" is placed in front of a member of the list, it means "and not this". The following example means if the user is in groups Accounting or Sales and the user isn't Marc.


Example:
if Groups=Accounting,Sales Users=!Marc

Unlike IniMan, the not symbol can be mixed freely.


Example:
if Groups=Accounting,!Sales

IniMan conditionals can be freely mixed with IniTyme conditionals. Inityme supports using IF instead of ;*. The following two statements are the same:


    ;*Groups=Accounting,Payroll and (DayOfWeek = 'FRI')
    if Groups=Accounting,Payroll and (DayOfWeek = 'FRI')

IniTyme does not support IniMan REV statements because they are not necessary in IniTyme. IniMan required REV statements in order to change lines in the INI file to a new value. IniTyme does this by default.

IniMan


  ;*Rev=Always
  Shell=SMENU.EXE

IniTyme

  Shell=SMENU.EXE

INIMAN CONDITIONALS -------------------

Groups=Group1,Group2,Group3 Returns true if the user is a member of any of the listed groups.


Example:
if Groups=Accounting,Sales

Users=User1,User2,User3 Returns true if the user is one of the listed users.


Example:
if Users=Marc,Pete,Phil,Grace

Hardware=VGA Returns true if one of the listed hardware pieces is present.


Example:
if Hardware=VGA,EGA,Math,!8086

Stations=Station1,Station2,Station3 Returns true if the station is one of the listed stations. The comparison is based on partial string compares so that you could match a range of station numbers.


Example:
if Stations=0c3456,345,0a4b337

Network= Returns true if user is on the specified network.


Example:
if NetWork=Novell

File=File1,File2,File3 Returns true if any listed files exists.


Example:
if File=c:\net.cfg,c:\shell.cfg

Dir=Dir1,Dir2,Dir3 Returns true if any listed directories exists.


Example:
if dir=c:\windows,w:\windows

BACKUPS -------

Whenever INITYME runs it creates a backup of the original file with a *.BNI extension. If you decide you don't like the changes you've made you can execute a one generation restore with the command:


     INITYME RESTORE SYSTEM.INI

This will delete the current SYSTEM.INI file and rename the SYSTEM.BNI file to SYSTEM.INI. If a matching BNI file is not present then the restore command does not do anything.

If by chance you are in a situation where murphy has tried to make your day really bad and you've screwed up your INI files royally, be sure to remember the SALVAGE command from netware. But nothing, not even salvage, is an acceptable substitute for a current set of backups. One suggestion might be to use PKZIP to ZIP up a set of your pre-modified INI files. This gives you the opportunity to play without risk. Nothing beats backups!

BACKUP NAME -----------

By default, the backup extension for INI files is BNI. Hoewever, if you want to change this, use can use the BackupName command in the change file as follows:


Example:
BackupName 'MYBAK.TXT'

If you want to change only the extension of the backups, then start the BackupName with '*.' as follows:


Example:
BackupName '*.XXX'

NOBACKUP --------

The NoBackup command is used if you don't want to create the BNI backup file. This will save disk space, however, you lose the safety of having the ability to undo what you just did. The BNI file is actually created and then deleted, so if you have Novell's salvage of and UnDelete command you can get the BNI file back.

PIPING FILENAMES ----------------

IniTyme can be used to update many INI file in bulk by creating a ListFile contains a list of INI files. Then simply provide IniTyme with the filename of the list file instead of a specific INI file. The syntax of a list file should be something like:


     \home\phil\windows\system.ini
     \home\marc\windows\system.ini
     ...etc...

You can also pipe a list of files to IniTyme as follows:


  WHEREIS SYSTEM.INI|INITYME CHANGE.INI

File name references in INITYME can include references to environment variables. Thus \HOME\%USER%\WINDOWS\SYSTEM.INI is a valid filename if the environment variable USER is set.

LOGGING CHANGES ---------------

If you want to create a log file of the changes that were made to the file add the command:


  LOG [FileName]

in your CHANGE.INI file, before the first section header, and INITYME will log the changes in the FileName you specify. If the FileName isn't specified the default name is your INI file name with a LOG extension.

If you want the log to append to and existing log file, use the command:


  APPENDLOG [FileName]

YAK MODE -------- If Yak is on, all changes will be displayed on the screen. To turn Yak on, add a line with the word "Yak" before the first section.

TEST MODE ---------

If you want to test a change file without changing the original INI file then add the word TestMode to the CHANGE.INI file before the first section header. In test mode the changes are written to the BNI file and the INI file is left untouched. You can then look at the BNI file to see the changes.

Prev Next Home Home Table Of Contents Index

Sponsors
Shopping
Forum
Forum
email
EMail
Index
Index
Home
Home