It is currently May 22nd, 2024, 7:46 am

Need NEW help understanding WriteKeyValue

Get help with creating, editing & fixing problems with skins
User avatar
JoBu
Posts: 271
Joined: February 16th, 2011, 12:46 am
Location: California

Need NEW help understanding WriteKeyValue

Post by JoBu »

Yeah, I'm stuck again.

This time, I'm trying to write to a Settings.inc file in the same folder as the skin sending the command.

Here's what I tried:

Code: Select all

LeftMouseDownAction=!Execute [!RainmeterWriteKeyValue Variables SkinBG01 #dark# ("Settings.inc")][!RainmeterRefreshApp]
And obviously it failed. What I'm after is a configuration setting, wanting to change all backgrounds to light or dark.

In "Settings.inc" I have two options and a variable, written as:

Code: Select all

[Variables]

dark=0,0,0,60
light=255,255,255,20
SkinBG01=#light#
I want a mouseclick to execute a writekeyvalue to the Settings.inc file that changes the "SkinBG01=" by adding #dark# or #light# but the variable just writes to the top of the current skin instead of going to the Settings.inc file.

Any advice would be appreciated. I'm still trying some variations, but reading through the manual didn't really clear it up and I'm kinda shooting into the dark here. I'll be going through the APB configuration skin to see if I can puzzle it out, but I think that writes to the same skin, rather than an exterior file.
Last edited by JoBu on March 13th, 2012, 7:54 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [SOLVED] Need help understanding WriteKeyValue

Post by jsmorley »

Code: Select all

LeftMouseDownAction=!Execute [!WriteKeyValue Variables SkinBG01 #dark# "#ROOTCONFIGPATH#Variables\Settings.inc"][!Refresh #CURRENTCONFIG#]
If you really do want to refresh all skins and not just the current one, then

Code: Select all

LeftMouseDownAction=!Execute [!WriteKeyValue Variables SkinBG01 #dark# "#ROOTCONFIGPATH#Variables\Settings.inc"][!Refresh *]
I can't think of any good reason why you would want to do a full !RefreshApp, but you can

Code: Select all

LeftMouseDownAction=!Execute [!WriteKeyValue Variables SkinBG01 #dark# "#ROOTCONFIGPATH#Variables\Settings.inc"][!RefreshApp]
Don't add the "Rainmeter" prefix on !Bangs. That will still work, but is not needed anymore.
User avatar
JoBu
Posts: 271
Joined: February 16th, 2011, 12:46 am
Location: California

Re: [SOLVED] Need help understanding WriteKeyValue

Post by JoBu »

**Got it, thanks for the tip - I'll try to get out of the habit, lol**

Figured it out, needed to add a variable to the firing skin that gave the location of the target file:

Code: Select all

[Variables]
@include=#SKINSPATH#Revelation2\Variables\Settings.inc
@include2=#SKINSPATH#Revelation2\Variables\UserVariables.inc
@include3=#SKINSPATH#Revelation2\Variables\Style.inc
WRITETO=#ROOTCONFIGPATH#Variables\Settings.inc
Then, in the meter, call to the file you're writing to using the variable (in this case, "WRITETO") along with a refresh, and perfecto:

Code: Select all

[ConfigureBG]
Group=Settings
Meter=IMAGE
SolidColor=#SkinBG01#
X=25
Y=28
H=200
W=280

[DarkBG]
Meter=STRING
MeterStyle=StyleFont
Group=Settings
X=20r
Y=10r
W=115
H=12
Text="Dark Background"
LeftMouseDownAction=!Execute [!WriteKeyValue "Variables" "SkinBG01" #dark# "#WRITETO#"][!RefreshApp]

[LightBG]
Meter=STRING
MeterStyle=StyleFont
Group=Settings
X=r
Y=15r
W=115
H=12
Text="Light Background"
LeftMouseDownAction=!Execute [!WriteKeyValue "Variables" "SkinBG01" #light# "#WRITETO#"][!RefreshApp]
Well, that's all the damage I can do tonight. Hasta manana.
Last edited by JoBu on March 11th, 2012, 12:16 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [SOLVED] Need help understanding WriteKeyValue

Post by jsmorley »

JoBu wrote:Figured it out, needed to add a variable to the firing skin that gave the location of the target file:
There is really no need to add a variable to do that. See my post right above your last one.
User avatar
JoBu
Posts: 271
Joined: February 16th, 2011, 12:46 am
Location: California

Re: [SOLVED] Need help understanding WriteKeyValue

Post by JoBu »

I could swear that I tried that once before... dang it.

All better now, working great and no messy double-entry variable baloney. Bologna. w/e.

Thanks mate, that should help me do a lot for these skins now... really appreciate it.

Cheers.
[Variables]
@include=#SKINSPATH#Revelation2\Variables\Settings.inc
@include2=#SKINSPATH#Revelation2\Variables\UserVariables.inc
@include3=#SKINSPATH#Revelation2\Variables\Style.inc

[ConfigureBG]
Group=Settings
Meter=IMAGE
SolidColor=#SkinBG01#
X=25
Y=28
H=200
W=280

[DarkBG]
Meter=STRING
MeterStyle=StyleFont
Group=Settings
X=20r
Y=10r
W=115
H=12
Text="Dark Background"
LeftMouseDownAction=!Execute [!WriteKeyValue Variables SkinBG01 #dark# "#CURRENTPATH#Settings.inc"][!Refresh *]

[LightBG]
Meter=STRING
MeterStyle=StyleFont
Group=Settings
X=r
Y=15r
W=115
H=12
Text="Light Background"
LeftMouseDownAction=!Execute [!WriteKeyValue Variables SkinBG01 #light# "#CURRENTPATH#Settings.inc"][!Refresh *]
User avatar
JoBu
Posts: 271
Joined: February 16th, 2011, 12:46 am
Location: California

Re: [SOLVED] Need help understanding WriteKeyValue

Post by JoBu »

Is it possible to take User Input [InputText] and write that input into a separate file, in a specific place? Kind of a 'replace' write to... a la:

- User inputs a value, like a color "red"

- input becomes a variable "#red#"

- WriteKeyValue pushes that data to an .inc file, and replaces "Color=#green#" with "Color=#red#"

That's kind of what I'm after... anyone have some leads? I've been looking for skins that show some example of this, but have yet to find one.

If the user input (red) is set to a variable at the top of the .ini file calling, that would be fine. How would I then use that variable to write to a specific spot? I can WebParse the document, and I've figured out RegEx (after a fashion) enough to get parts to display... I want to replace three lines of an external document every time a button on the skin fires.

Any help/advice/leads would be appreciated. Cheers.

//JoBu