You don't really need a file for that. You can much more simply store your settings into the registry using setenv:
http://www.cadtutor.net/forum/showthread.php?61283-Environment-Variables&p=416434&viewfull=1#post416434Simply put, your ACadDoc.LSP would contain some code to run per DWG opened. It checks to see if the XRecord exists - if so it sets the "current" country by highlighting the correct button and setting the flyout's icon accordingly. If it doesn't exist then check your global setting using getenv, if that exists then set the buttons according to that and save into the DWG's XRecord. If that also doesn't exist, it means the user's never before clicked any of your buttons - so you need to decide on a default (perhaps derived from the (getvar "LACALE").
Then your code for clicking one of the flag buttons would do the following:
- Highlight the button's icon as per my previous code.
- Set the flyout button's icon to the same.
- Save the country code to the DWG's XRecord.
- Save the country code to the registry also (using setenv) to store the last country selected as default
- Set the global variable to the country code for quick access in your other codes
There's one issue though: What if the user has more than one DWG open at the same time, and (at least) one of those has a different country code set in its XRecord? You might need to incorporate a docmanager reactor to check if documentToBeActivated, then also documentBecameCurrent. If both those happened on the same DWG, then you would need to re-read the XRecord and set the buttons accordingly.
If you want your app to work on other cads where there is no registry (e.g. BricsCAD on Linux / AutoCAD on Mac), then I'd go with a settings file in one of the support folders. But if you need to cater for such non-windows cads, these routines won't work anyway - since you would not have the vla / vlax functions available.