You have the ability to write to and read from files inside Altium scripts. This can be useful for saving user configuration data that persists between each time the script is run, or providing input/output data for a particular script that needs to interact with the operating system.
The objects of interest are
TIniFile is great for storing category-key-value (or just key-value) information.
Creating An INI File
You can create an INI file by using:
var myIniFile myIniFile = TIniFile.Create(fileName)
fileName is an absolute path string to the file you wish to create (e.g.
Reading And Writing To INI Files
You can write a boolean-based data point using:
iniFile.WriteBool category, key, trueFalse
trueFalse is a `boolean.
You can read a boolean-based data point from an
INI file using:
Dim myBool myBool = myIniFile.ReadBool(category, key)
Similarly to writing a boolean, you can write a string-based data set using:
iniFile.WriteString category, key, value
value are all strings. This will create an INI file which looks like this:
You can read a data set from an INI file using:
value = iniFile.ReadString category, key