Client Management Suite

 View Only

Editing INI File Using WiseScript 

Jan 06, 2009 11:40 AM

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

Statistics
0 Favorited
0 Views
12 Files
0 Shares
0 Downloads
Attachment(s)
jpg file
7381.jpg   2 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI1_0.jpg   10 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI10_0.jpg   7 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI11_0.jpg   17 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI2_0.jpg   6 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI3_0.jpg   7 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI4_0.jpg   8 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI5_0.jpg   16 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI6_0.jpg   7 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI7_0.jpg   8 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI8_0.jpg   9 KB   1 version
Uploaded - Feb 25, 2020
jpg file
INI9_0.jpg   7 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Dec 10, 2010 02:47 PM

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

Feb 24, 2010 10:22 PM

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.

Oct 26, 2009 05:50 PM

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./

Oct 26, 2009 03:45 PM

We can edit that in WSI itself..

May 14, 2009 11:45 AM

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

Related Entries and Links

No Related Resource entered.