Script Library: 1238 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Documentation for: parse-ini.r


Windows INI file parser

Sunanda
October 2003

Contents

1. Overview

A Windows ini file has this structure:

 [section-name1]
 keyword1=somevalue
 keyword2=someothervalue
 [section-name2]
 keyword3=yetanothervalue

There may be many sections, and each will have zero or more keywords.

The two functions in this script are:

1.1 parse-ini-file

Takes a whole ini file and converts it to a REBOL hash structure:

 ["section-name" ["keyword1" "somevalue" "keyword2" ...] ...]

1.2 find-in-ini

Return a value from an ini file. Returns false if the section and keyword do not exist.

1.3 Examples

 ini: parse-ini-file %/c/windows/win.ini

 print find-in-ini ini "ports" "com1:"
 print find-in-ini ini "intl" "iCountry"
 print find-in-ini ini "truetype" "FontSmoothing"
 print find-in-ini ini "xxx" "xxxx"