Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

Editing INI File Using WiseScript

Updated: 06 Jan 2009 | 5 comments
Sidd's picture
+12 12 Votes
Login to vote

There are many ways to edit an INI file in the machine. Following article describes editing INI file using WiseScript. Using WiseScript one can Add/modify/delete a section and its content.

Introduction

INI files are simple text files with a basic structure that contain configuration information. They are commonly associated with Microsoft Windows, but are also used on other platforms. The name "INI file" comes from the filename extension usually used, ".INI", that stands for "initialization".

Format of .INI Files

INI files contain one or more sections. Each section begins with a section name, which is followed by zero or more entries. An entry associates a keyname with a value.

The general format is:

[section]
keyname=value

Comments can also be included in the file by prefacing the comment with a semicolon (;)

Step by step Guide to Edit INI files Using WiseScript

Start Wise Package Studio then open WiseScript Package Editor by double-clicking.

Click the Script Editor tab.

Select Set Variable under All Items in script editor tab.

Double-click on Set Variable

Set Variable

This action sets the value of a variable by providing a literal value, by modifying the variable's existing value, or by evaluating an expression.

Variable: Specify a variable. A variable name must begin with a letter, must contain only numbers, letters, and underscore characters, and must be 28 characters or less. It should not be enclosed in % signs.

New Value: Enter the new value of the variable. If you enter a variable, enclose it in % signs. The value of a variable can be up to 32K in size.

To complete the dialog fill in the information:

Variable: MYVARIABL
New Value: C:

Here I would like to edit Ini (MyApp.ini) file which is located at "C:\Program Files\My Application\MyApp.ini"

By changing the following values as highlighted in [GUID] section

WindowWidth=380
WindowHeight=96

Select Edit INI File under All Items in script editor tab
Double-click on Edit INI File

Edit INI File

This action edits an .INI file on the destination computer. When a WiseScript is called by a Windows Installer installation, you also can edit an .INI file on the Features or Components tabs of Setup Editor in Windows Installer Editor.

Note: When a WiseScript is called by a Windows Installer installation, the Windows Installer installation does not recognize changes that the WiseScript makes to the destination computer and will not uninstall them. Therefore, you must provide a way to uninstall or repair such changes.

To complete the dialog following information is required:

  • File: Enter the .INI file path, or select a path from the list and edit it.
  • INI File Contents: Enter changes to make in the .INI file.

Changes are interpreted as follows:

To add to a section, type the section name in brackets, then type new lines for that section. If the .INI file already contains a name-value pair that you type, the existing line is replaced by the new one. Example:

[SECTIONNAME]
Name=value 

To delete a section and its contents, type a section name with no lines after it. Example:

[SECTIONNAME]

To delete a name-value pair, type the name with an equals sign followed by nothing. Example:

Name= 

Comments (lines starting with ;) are not supported.

To complete the dialog fill in the information

File: 
%MYVARIABL%\Program Files\My Application\MyApp.ini
INI File Contents: 
[GUI]
WindowWidth=500
WindowHeight=200

Note: Here I would like to change WindowWidth from 380 to 500 and WindowHeight from 500 to 200.

This is just an example.

Click Ok to close the dialog

This is the simple way of editing INI file with two line of code using WiseScript, this can done using VBscript.

Once finished, Save the WiseScript and then compile the script.

Once you run the WiseScript, it will edit the [GUI] Section with the values as desired.

WindowWidth=500
WindowHeight=200

Good luck.

Thanks,
Sid

Comments

AltirisUser's picture
14
May
2009
0 Votes 0
Login to vote

Very helpful

This is very useful when you want to edit INI files of the local system.  It  helped me a lot.

WiseUser's picture
26
Oct
2009
0 Votes 0
Login to vote

We can edit that in

We can edit that in WSI itself..

Wiseuser
Altiris Certified Professional

ianatkin's picture
26
Oct
2009
1 Vote +1
Login to vote

Hi Sid, Is there a particular

Hi Sid,

Is there a particular reason for preferring the script route, rather than making your changes in the ini files area of the Wise application?

Admittedly I'm pretty new to wise,  but on the face of it I have agree with Wiseuser. You can edit ini files in the main interface of Wise without going into scripts. For instance I've use Wise to enter additions to the ATools.ini in Deployment Server. This has the advantage that uninstalling the application removes those additions.

I think!

Kind Regards,
Ian./ 

Kind Regards,
Ian./

Ian Atkin, Senior Developer for the ICT Support Team, Oxford University, UK

Connect Etiquette: "Mark as Solution" those posts which resolve your problem, and give a thumbs up to useful comments, articles and downloads&

Rhys Paterson's picture
24
Feb
2010
0 Votes 0
Login to vote

The problem I have with using

The problem I have with using the tables in Setup Editor or the 'Ini Files' option in Installation expert is that it forces you to use an equals '=' sign in the file.

I have some variables that the application needs to reads in for a configuration setting, however they are speperated by colons ':' and not an equals sign.

I can't use the tables or the gui to insert variables with a colon. WiseScript  seems to be the only way around it - although I haven't tried it.

thomas.sonderman@biomet.com's picture
10
Dec
2010
0 Votes 0
Login to vote

Adding at the end

If I put an ini change in wisescript will it run at the end of the installation?