Mathematica can import .ini files, although it wants the data definitions to be in the form "item=value". That is, it does not expect white space. Also, it doesn't understand that ".true." and ".false." represent booleans. Still there are advantages to importing the file directly as an .ini file.
Let's explore how we might go about it.
I will use a file called data.ini which contains the text
a = 1234.0
b = .false.
c = 1.23e3
d = text
e = -1.23E-2
f = .true.
As you can see this file provides a greater range of test data than the one you proposed.
path = FileNameJoin[{$HomeDirectory, "Desktop", "data.ini"}];
iniData =
Association[
Map[StringTrim[StringTrim[#], "."] &, Import[path, "DataRules"], {-1}]]
<|"a" -> "1234.0", "b" -> "false", "c" -> "1.23e3", "d" -> "text",
"e" -> "-1.23E-2", "f" -> "true"|>
We get an association. However, we still need to convert the strings representing numbers and booleans to Mathematica numbers and booleans. I suggest doing that with an interpreter because interpreters can recognize the strings "true" and "false" and handle Fortran numbers of the form "1.23e03", and "45.12E-3".
data = Interpreter["Number" | "Boolean"| "String"] /@ iniData
<|"a" -> 1234., "b" -> False, "c" -> 1230., "d" -> "text",
"e" -> -0.0123, "f" -> True|>
I think the association data
might be an entirely satisfactory representation for your .ini file data and that there is no need to go further. But if you insist on making assignments, they can be done this way.
Clear[a, b, c, d, e, f]
KeyValueMap[Set[Evaluate[Symbol[#1]], #2] &, data];
{a, b, c, d, e, f}
{1234., False, 1230., "text", -0.0123, True}
Update
The above requires V11.1 or later. Those using an earlier version should try
data =
Association[
Rule @@@
(Import[path, "Table"] /.
{"=" -> (## &[]), ".true." -> True, ".false." -> False})]
This code, while somewhat more obscure in concept, has advantages even for those who have V11.1. (Doesn't require the use of Interpreter
.) Still requires a version late enough to support associations.