It is currently April 26th, 2024, 1:18 pm

WriteKeyValue to multiple files at once

Get help with creating, editing & fixing problems with skins
GyRoZz
Posts: 5
Joined: May 7th, 2018, 1:18 pm

WriteKeyValue to multiple files at once

Post by GyRoZz »

Hello everyone,

Normally I browse the entire internet to find an answer to something before just asking it. This time, I still did that, but as I couldn't find my answer I decided to come here.

I have this skin I'm working on. It's a skin for application buttons (like Honeycombs for example) but with great customizability. For every button there are 2 settings files. 1 for the button itself, and one 'main' file, which can be easily used for every button if you would like the same design for every button. Here is the hierarchy:

SkinRoot
- @Resources
- main.inc
- Button1
-icon.png
- button1.ini
- Settings
- active.inc
- individual.inc
- settings.ini
- Button2
- icon.png
- button2.ini
- Settings
- active.inc
- individual.inc
- settings.ini
- Button3
- icon.png
- button3.ini
- Settings
- active.inc
- individual.inc
- settings.ini
- Settings.ini

Out of the Root directory's Settings.ini you can select the options 'Set for all'. What this does is changing a variable in every active.inc to #@#main.inc

So at first the active.inc looks like this:

Code: Select all

[Variables]
stylesheet=Settings\individual.inc
and after selecting 'Set for all' like this:

Code: Select all

[Variables]
stylesheet=#@#main.inc
Now this is where the 'problem' lies. What I have right now is this:

Code: Select all

[TitleStyle]
Meter=String
Text="Set for All"
LeftMouseUpAction=[!WriteKeyValue Variables stylesheet "#@#main.inc" "button1\settings\active.inc"][!WriteKeyValue Variables stylesheet "#@#main.inc" "button2\settings\active.inc"][!WriteKeyValue Variables stylesheet "#@#main.inc" "button3\settings\active.inc"][!RefreshGroup Apps]
Whereas all the button.ini files are grouped under 'Apps'. The above code works, but as you might imagine, this is not ideal when you're dealing with a lot of different buttons. So my question to you is, is there a better way of dealing with this problem? Where you would just say something like:

Code: Select all

[!WriteKeyValue Variables stylesheet "#@#main.inc" "All active.inc files under SkinRoot"]
I would immensely appreciate any help to the matter, I've been stuck on this one for a while now.


Thanks in advance,
Gideon
Last edited by GyRoZz on May 7th, 2018, 1:55 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WriteKeyValue to multiple files at once

Post by jsmorley »

No sorry, !WriteKeyValue must be specific and individual.
GyRoZz
Posts: 5
Joined: May 7th, 2018, 1:18 pm

Re: WriteKeyValue to multiple files at once

Post by GyRoZz »

jsmorley wrote:No sorry, !WriteKeyValue must be specific and individual.
Thank for replying, that's a shame.. I presume there is no other bang that could possibly achieve this?
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WriteKeyValue to multiple files at once

Post by jsmorley »

GyRoZz wrote:Thank for replying, that's a shame.. I presume there is no other bang that could possibly achieve this?
No. You can write to multiple files with Lua, but that isn't going to work well with .ini / .inc files which are likely to not be encoded with the ANSI / UTF-8 that Lua wants.
GyRoZz
Posts: 5
Joined: May 7th, 2018, 1:18 pm

Re: WriteKeyValue to multiple files at once

Post by GyRoZz »

jsmorley wrote:No. You can write to multiple files with Lua, but that isn't going to work well with .ini / .inc files which are likely to not be encoded with the ANSI / UTF-8 that Lua wants.
Aha, alright. Thanks for the clarification!