It is currently March 29th, 2024, 11:53 am

Dynamic skin creation - is it possible?

Get help with creating, editing & fixing problems with skins
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Dynamic skin creation - is it possible?

Post by David8192 »

sl23 wrote: September 17th, 2021, 9:33 am Easier if you know lua! :sly:
Exactly! :bow:
Honestly it would be quite easy if the skins to be made have the same components
Here is Sample code of what I meant.

Code: Select all

[Rainmeter]
Update=-1
DynamicWindowSize=1
AccurateText=1

[Free]
Meter=Shape
Shape=Rectangle 0,0,100,100
LeftMouseUpAction=[!WriteKeyValue Xample Meter "String" Tym.ini][!WriteKeyValue Xample FontSize "20" Tym.ini][!WriteKeyValue Xample FontColor "255,255,255" Tym.ini][!WriteKeyValue Xample Padding "5,5,5,5" Tym.ini][!WriteKeyValue Xample Text "Fun Time" Tym.ini][!WriteKeyValue Xample StringStyle "Bold" Tym.ini][!WriteKeyValue Xample AntiAlias "1" Tym.ini][!WriteKeyValue Rainmeter Update "1000" Tym.ini][!WriteKeyValue Rainmeter AccurateText "1" Tym.ini][!WriteKeyValue Rainmeter DynamicWindowSize "1" Tym.ini][!EditSkin "Make Shape" "Tym.ini][!RefreshApp]
Create an empty INI file, name it Tym.ini and Save it in the same folder as the code above. After refreshing Rainmeter, load the first file and click on it. After that you can toggle the previously empty skin.
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Re: Dynamic skin creation - is it possible?

Post by Edhel »

Oooh :D I started the topic and don't have enough time to read it now :)
I do not know LUA (yet), but I understand it will be necessary to learn for this to work. I haven't worked with Powershell neither, so that will be new area for me to cover too.
death.crafter wrote: September 14th, 2021, 5:37 pm Then define a function that will delete the config upon deactivation, tho deactivation should not be triggered by OnCloseAction.
I do see why. Thank you for pointing that out. :thumbup:
David8192 wrote: September 17th, 2021, 11:11 pm Create an empty INI file, name it Tym.ini and Save it in the same folder as the code above. After refreshing Rainmeter, load the first file and click on it. After that you can toggle the previously empty skin.
Unfortunately, that would work for only previously defined number of skins. (In your example for just one skin Tym.ini) I am thinking about creating as many skins as the user wants. (And I hope they will be reasonable :) )
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Dynamic skin creation - is it possible?

Post by death.crafter »

Edhel wrote: September 18th, 2021, 6:28 pm Oooh :D I started the topic and don't have enough time to read it now :)
I do not know LUA (yet), but I understand it will be necessary to learn for this to work. I haven't worked with Powershell neither, so that will be new area for me to cover too.

I do see why. Thank you for pointing that out. :thumbup:


Unfortunately, that would work for only previously defined number of skins. (In your example for just one skin Tym.ini) I am thinking about creating as many skins as the user wants. (And I hope they will be reasonable :) )
@Resources\Script\SkinCreater.ps1

Code: Select all

param(
    [int32]$index
    [string]$folderPath
)

$template=@"
[MeasureTime]
Measure=Time
Format=%H:%M

[MeterTime]
Meter=String
MeasureName=MeasureTime
Text=#Meter $($index) : %1
FontSize=20
AntiAlias=1
"@

if ((Get-ChildItem $folderPath -Directory | Select Name) -notcontains "Skin$index") {
    New-Item $folderPath -name "Skin$index" -type Directory
}

$template | Out-File "$($folderPath)Skin$index\Main.ini"
Creator.ini

Code: Select all

[Rainmeter]
Update=-1
OnRefreshAction=

[Variables]
Index=1

Activate=[!ActivateConfig "#ROOTCONFIG#\Skin#Index#"]
Clear=[!WriteKeyValue Rainmeter OnRefreshAction ""]

[RunCommand]
Measure=Plugin
Plugin=RunCommand
Program=Powershell
Parameter=& '#@#Scripts\SkinCreator.ps1' -index #Index# -folderPath '#ROOTCONFIGPATH#'
FinishAction=[!WriteKeyValue Rainmeter OnRefreshAction "[#*Activate*][#*Clear*]"][!RefreshApp]
DynamicVariables=1

[Button]
Meter=Image
W=20
H=20
LeftMouseUpAction=[!SetVariable Index ([#Index]+1)][!WriteKeyValue Variables Index [#Index]][!UpdateMeasure RunCommand][!CommandMeasure RunCommand Run]
Something like this.
from the Realm of Death
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Dynamic skin creation - is it possible?

Post by David8192 »

Edhel wrote: September 18th, 2021, 6:28 pm
Unfortunately, that would work for only previously defined number of skins. (In your example for just one skin Tym.ini) I am thinking about creating as many skins as the user wants. (And I hope they will be reasonable :) )
I was hoping that a text input box could be used to define some parameters including the number of skins. (Maybe Powershell could be alright after all - if it can autogenerate folders and empty skins, that is)
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Re: Dynamic skin creation - is it possible?

Post by Edhel »

death.crafter wrote: September 18th, 2021, 7:37 pm Something like this.
Wow, thank you for pushing me the right direction :D :thumbup: I had some issues to get the powershell running but it finally works. (The for some reason, I couldn't run a script in the @Resources folder...)
David8192 wrote: September 19th, 2021, 11:55 pm I was hoping that a text input box could be used to define some parameters including the number of skins. (Maybe Powershell could be alright after all - if it can autogenerate folders and empty skins, that is)
I came to the same conclusion - I will probably add some input to let the user set how many skins they want. Unless there is a way how to load the new skin without refreshing Rainmeter. I do like the idea that death.crafter suggested:
death.crafter wrote: September 14th, 2021, 5:37 pm Writekeyvalue OnRefreshAction to
- - - ActivateConfig NewConfig and
- - - Writekeyvalue OnRefreshAction to blank.
However it could easily become annoying with five or more new skins. So we can let the user create set of 10 new skins, refresh Rainmeter and then just let them to modify (set the desired app for launcher or so) and place it somewhere.
I would really love to avoid refreshing Rainmeter at all. I know it is possible to write new values into the main Rainmeter config so we could add the new skin there, but I guess Rainmeter has the data stored in some session while running and there is probably no way to access that... I wonder what would the Devs say to that idea... :???:
User avatar
David8192
Posts: 246
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Dynamic skin creation - is it possible?

Post by David8192 »

Edhel wrote: September 20th, 2021, 5:18 pm However it could easily become annoying with five or more new skins.
Right. I see why you want to avoid the refresh.
Edhel wrote: September 20th, 2021, 5:18 pm I wonder what would the Devs say to that idea...
That would save us some minor headaches :Whistle
:lol:
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X