This is a very simple project / extension to understand how to manage a config file with JSON en/decode and global variables. You don't have to use global variables, I've used it because it makes the management easier.
I hope you can do something with it. There is currently not fallback with default values, In the "SaveSettings" block you only have to set the names of your global variables which you want to read and write out to the file.
You can also load your settings on the startup of GP. This is my startup.gp:
Code: Select all
to startup {
setGlobal 'vectorTrails' false
loadSettings
openProjectEditor true true
}
You only need to execute "loadSettings" which I've stored in a "settings.gp" in the lib folder
If you want to output formated json file, you have to use
Code: Select all
(stringify (initialize (new 'JSONWriter')) dict true)
instead of (jsonStringify dict) because you need the formatFlag, it is the last argument in the code line.