Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
I have configuration files in INI format. I would like to read these in Mahcad. Can someone give me a tip as I can read the values individually one by one in MathCad variables?
Something like a := READ(File,Section,valuename)
Solved! Go to Solution.
Here is a first approach. Not much error handling included and will work for "well behaved" ini-files and numerical values only.
MC15 worksheet attached
Here's the first incarnation in Prime 4:
Which also works in Prime express.
Success!
Luc
Corrected an error where it would miss the last character of a parameter value.
Since the ReadIni(file, section, parameter) approach doesn't care about comment statements, it's sort of immune to them. This function will even handle this .INI file https://downloads.avaya.com/elmodocs2/ip_phones/r2_7/output/16_601433_2/IPTel_Server044.html
Luc
You'll have to be more specific about the structure of an "INI-file".
Here is a first approach. Not much error handling included and will work for "well behaved" ini-files and numerical values only.
MC15 worksheet attached
Note that you test.ini file fails to assign a value to "RT6Kanal" in section [A-Achse]. That will produce a 0 value for that parameter in my update of the function.
Luc
I guess that's how it works. The forum doesn't tell you which is the solution, it's up to you, the Original Poster (OP), to decide which of the reactions you consider to be THE solution.
Success!
Luc
Here's another approach.
In your 'windows' directory you'll find more .INI files. Example:
Success!
Luc