Configuration/preferences file

Also using SQlite here.

OTOH, it’s quiet easy to store encrypted data within it :slight_smile:

I am using SQLite because i don’t want user to fiddle with the text file.

That seems like something out of Opposite World. :slight_smile:, still a great source of knowledge: [Writing a Preferences Class, by Charles Yeomans]

what i have in my config file is usually expiry date for demo, whether it is mac or window, license to who and what date and what release no.

[quote=60726:@Paul Lefebvre]One solution that is pretty simple is to use JSONItem to store values in a Dictionary-like manner. Then you can just save and load this JSON data to a file pretty easily.
For an example of this, check out the Developing a Text Editor webinars. I believe part 2 covers saving preferences.

Thanks for this, it’s good and easy
I have the preferences instance from your webinar integrated in a module, so I can always import it if I need it.


I use app.ShortVersion, so I need to change not so much for the next project.


[quote=61028:@Dave S]Windows dropped support for INI files in preference to the awful REGISTRY years and years ago.

my class “mimics” INI in the fact that is has sections, keys and values… and stores things in plain text[/quote]

Not that it has to do with anything, but I believe I use a variant of your INI class for SMBUp and it’s so comfortable I even use shell sed commands to turn some helper output into INI format for parsing with it.

I recently switched the preferences saving to macoslib’s TTsmartprefs Just to comply more with the MAS but I still use your INI class heavily in lots of other places.

I tried using preferencesmodule sample found on the web in my app but when i initialize is all OK .
The problem in when i try saving preferences in app close. There’s an error “there is more than one item with this name” but i don’t understand the issue.

The notes in preferencesmodule say:

Manages your local application preferences. Preferences are loaded and saved


In your App.Open event, call PreferencesModule.Initialize(“MyAppName”)
before using the PreferencesModule

Preferences.Load loads your preferences
Preferences.Save saves your preferences

To assign preferences values:

Preferences.PrefName = value Or Preferences.Set(“PrefName”) = value
value = Preferences.PrefName Or value = Preferences.Get(“PrefName”)

If you attempt to access a preference that does not exist, a
PreferenceNotFoundException is raised.

But i don’t know the usage of Preferences,Save