by Mark C
Version 1 (February 2, 2016)
Download (1,355 downloads)
Use in your flows to create and read a configuration file.
*Updated version: it is now possible to store and retrieve Dictionary and Array variables in the Config Dictionary Variable ( but they cannot be nested!). This version was NOT created with an alpha version of Automate (sorry about that).
Config file is plain text with each line being of the form:
item=Value
EG:
item1=Something
Item2=2
MyItem=This
Email=someone@example.com
-ArrayItem=1, 2, 3, a, b, c
+DictionaryItem=1: 100, 2: 200, Three: Three Hundred
Format is a bit strict, no spaces between itemname=value but value can contain anything except an "=" character. No blank lines in the file. Values in Dictionary items cannot contain the ":" character and values in Array items cannot contain a "," (comma) character. You can get round this by changing the delimiters used when writing/reading the file.
To test, set variable "ConfigFile" to the path you want (default is "myconfig" on root of internal storage) and run the Flow. If no config file exists then an example is created, if a file exists then it is read into a Dictionary called "Config".
You should have no trouble using this example in your own flows: to read your config file just enter at " file exists" and to update the file (once you have the "Config" Dictionary filled) enter at "File Delete"
Access your config settings as: setting=Config[] EG. email=Config["Email"]
Change settings with Dictionary Put blocks.
5 stars | 1 | |
4 stars | 4 | |
3 stars | 0 | |
2 stars | 0 | |
1 star | 0 | |
Reports | 0 |
Rate and review within the app in the Community section.