It is currently October 9th, 2024, 6:56 pm

Solved: Trouble with writing to .inc file

Get help with creating, editing & fixing problems with skins
ZXCVBOT

Solved: Trouble with writing to .inc file

Post by ZXCVBOT »

Hi again! I am having some troubles implementing the write to file part. I want to write the variable "Current" to 1/2/3 in the Variables.inc file located in the @Resources folder. I tried searching, but saw people used what I tried already.

Code: Select all

ContextTitle6=Disable Glow
ContextAction6=[!WriteKeyValue "#@#Variables.inc" "Current" "1"][!WriteKeyValue Rainmeter Update 1000][!Refresh]
ContextTitle7=Enable Shadow
ContextAction7=[!WriteKeyValue "#@#Variables.inc" "Current" "2"][!WriteKeyValue Rainmeter Update 1000][!Refresh]
ContextTitle8=Enable Glow
ContextAction8=[!WriteKeyValue "#@#Variables.inc" "Current" "3"][!WriteKeyValue Rainmeter Update 100][!Refresh]
The above code throws no error, and I have tried quotes/magic-quotes and removed them.. I can't get what have I missed.. The root folder does not contain any spaces/special characters, neither do the skin files.

Edit: I already have checked this part in the manual: [!WriteKeyValue Variables Page 2][!Refresh] This just adds the things to the skin, not variables.inc file.

Edit 2: https://docs.rainmeter.net/manual/bangs/#WriteKeyValue Solved it..... :Whistle !WriteKeyValue Variables MyFontName Arial "#@#Variables.inc"
User avatar
balala
Rainmeter Sage
Posts: 16645
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Solved: Trouble with writing to .inc file

Post by balala »

ZXCVBOT wrote: November 8th, 2023, 12:43 pm Edit 2: https://docs.rainmeter.net/manual/bangs/#WriteKeyValue Solved it..... :Whistle !WriteKeyValue Variables MyFontName Arial "#@#Variables.inc"
Good catch! The file in which you want to write, same way as the name of the config in which you want to set a variable, option or do anything else with the appropriate bang, has to be the last parameter. There are no exceptions. Additionally in the first bangs of all ContextAction options (which should have been writing the Current variable), the number of parameters are too small. You forgot the name of the section in which you expect the option (in this case the variable) to be written.
Fixed now? Does it work as expected?
ZXCVBOT

Re: Solved: Trouble with writing to .inc file

Post by ZXCVBOT »

Yes! It does.. I posted it as Solved didn't I?

Code: Select all

ContextTitle6=Disable Glow
ContextAction6=[!WriteKeyValue Variables "Current" "1" "#@#Variables.inc"][!Refresh]
ContextTitle7=Enable Shadow
ContextAction7=[!WriteKeyValue Variables "Current" "2" "#@#Variables.inc"][!Refresh]
ContextTitle8=Enable Glow
ContextAction8=[!WriteKeyValue Variables "Current" "3" "#@#Variables.inc"][!Refresh]
Here's how.. ↑
User avatar
balala
Rainmeter Sage
Posts: 16645
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Solved: Trouble with writing to .inc file

Post by balala »

ZXCVBOT wrote: November 8th, 2023, 1:57 pm Yes! It does.. I posted it as Solved didn't I?
Did you? Maybe I'm missing something. Sorry for my mistake...