It is currently April 26th, 2024, 9:38 pm

Global Options for Plugins

Share and get help with Plugins and Addons
BadStreff
Posts: 2
Joined: August 4th, 2013, 7:32 pm

Global Options for Plugins

Post by BadStreff »

Hey guys, I'm writing a plugin for rainmeter wanted to know if there is a way to set-up global Options for plugins. I read in the documentation in the [Rainmeter] section is where you set this up, but this does not seem to be the case for plugins, which want each option defined explicitly in each measure. My current idea is have users who wish to use my plugin set up a one-time config file in the Plugins folder, but this seems a bit excessive if there is an easier way, thanks!
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: Global Options for Plugins

Post by poiru »

You can use RmGetSettingsFile() to obtain the path to #SETTINGSPATH#Rainmeter.data (i.e. %APPDATA%\Rainmeter\Rainmeter.data), which is generally where plugins store global data under a section named after the plugin (e.g. [YourPlugin.dll]).
BadStreff
Posts: 2
Joined: August 4th, 2013, 7:32 pm

Re: Global Options for Plugins

Post by BadStreff »

Thanks! Is there a best practice as to how to get data in there, I would rather not tell users they are going to have to edit that by hand.

Would it be safe to have my plugin check if there are values in the file and if not pull and import ones from a general measure to there?
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: Global Options for Plugins

Post by poiru »

BadStreff wrote:Thanks! Is there a best practice as to how to get data in there, I would rather not tell users they are going to have to edit that by hand.
That is really the only way unless you want to provide some sort of custom UI (e.g. a separate executable).
BadStreff wrote:Would it be safe to have my plugin check if there are values in the file and if not pull and import ones from a general measure to there?
Sure (remember to only touch the [YourPlugin.dll] section).