Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1752

Help: Rainmeter Skins • Re: Trying to create a settings saving system

$
0
0
Hello fellow Rainmeter enthusiasts! :welcome:

I'm working on a skin that shows the previous and next game for your favourite football/soccer team. It's been over a year since I began work on this project as I've had to put it aside for extended periods as university work piled up. However, now I can say the finish line is in sight and I'm hoping to release it in the coming weeks. Thanks to anyone here that helped me when I've faced issues with this before!

Now then, I need a bit of help with what should be the last feature to add to the settings of my skin. I'm looking to create a system for users to save their settings (layout, colours, fonts, etc.) in different files and be able to load them whenever they choose. My initial thought process was to somehow have the settings skin save the currently loaded variables to a new variables file and to then have a way to load such save files from within the settings itself. I've looked it up online but can't come up with how this can be done. So, I'm hoping to get an insight from folks here about whether this is possible and, if so, how I could do it. Thanks in advance! :D
If it's just about saving the current settings and having them persist the next time you load or refresh the skin, you'd use !WriteKeyValue to save values in your .inc files:
https://docs.rainmeter.net/manual/bangs/#Options
and have those .inc files @included in your skin:
https://docs.rainmeter.net/manual/skins/include-option/

However, if you're thinking of having multiple "sets" of settings that you can switch to at will, then things will become slightly more complicated since you'll probably have to design a small Explorer-like system where you can "choose" the desired settings / .inc file to use, either directly or via some additional "button":
https://docs.rainmeter.net/manual/plugins/fileview/
then !WriteKeyValue the corresponding @include options to the skin's .ini file before finally refreshing the skin to "load" the new settings / .inc file. Obviously, having single .inc files each containing a "set" of said settings / variable values would avoid complicating this system even further.

P.S. An alternative to using FileView would be to enter the desired .inc name manually, in an InputText measure:
https://docs.rainmeter.net/manual/plugins/inputtext/

P.S.S. The above describes only the "choosing" part of it, and assumes those settings / .inc files already exist. When it comes to actually creating such files before using !WriteKeyValue on them as usual, either a Lua function (you'd have to add the BOM characters from the script if you need a UTF-16 LE BOM file encoding, there's a thread by jsmorley on the forum about that) or some PowerShell command (preferable, as you can set the desired encoding) ran from a RunCommand measure will do the trick:
https://docs.rainmeter.net/manual/plugins/runcommand/
Didn't test it, but it might also be possible via a plain command line in the RunCommand measure (not sure about encoding in this case though).

Statistics: Posted by Yincognito — 41 minutes ago



Viewing all articles
Browse latest Browse all 1752

Trending Articles