It is currently April 27th, 2024, 12:33 am

Input Count Rainmeter skins

Get help with creating, editing & fixing problems with skins
Mekurukito
Posts: 21
Joined: July 8th, 2018, 6:09 am

Input Count Rainmeter skins

Post by Mekurukito »

hello, i have project to make a rainmeter :welcome:

so the first system that i want to make is a input count, so every "action" that has been registered will be added as a count numeric like, first action the result will be "1" second action the result will be "2" and third action the result will be "3" and etc

and the second system that i want to make is like a stopwatch that start from 0 but it will be counted as "ms" (1000ms = 1 second)

please tell me if its possible and if possible can you tell me how to make it?

thank you very much.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Input Count Rainmeter skins

Post by balala »

Mekurukito wrote: September 30th, 2019, 9:13 am so the first system that i want to make is a input count, so every "action" that has been registered will be added as a count numeric like, first action the result will be "1" second action the result will be "2" and third action the result will be "3" and etc
Yes, definitely possible. You have to crate a variable which will be dynamically increased with one on every cycle and will also be written permanently to the [Variables] section. If you don't know how to do this, later I'll post a sample code for you.
Mekurukito wrote: September 30th, 2019, 9:13 am and the second system that i want to make is like a stopwatch that start from 0 but it will be counted as "ms" (1000ms = 1 second)
Possible as well, however for a such thing you have to update at least a few measures and meters 1000 times per second, which is too much. For this you can use an ActionTimer plugin measure.
I'd recommend a lower update, for instance to count only 100 times perseconds, so not on milliseconds basis, but on 10 milliseconds. Would be much more feasable.
Mekurukito
Posts: 21
Joined: July 8th, 2018, 6:09 am

Re: Input Count Rainmeter skins

Post by Mekurukito »

balala wrote: September 30th, 2019, 9:44 am Yes, definitely possible. You have to crate a variable which will be dynamically increased with one on every cycle and will also be written permanently to the [Variables] section. If you don't know how to do this, later I'll post a sample code for you.

Possible as well, however for a such thing you have to update at least a few measures and meters 1000 times per second, which is too much. For this you can use an ActionTimer plugin measure.
I'd recommend a lower update, for instance to count only 100 times perseconds, so not on milliseconds basis, but on 10 milliseconds. Would be much more feasable.
thank you for the respond,
i dont how to make the first system, please send some code to me.
the second system,i understand and i already learn how to do "Action Timer", you can give me a code if you want to
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Input Count Rainmeter skins

Post by balala »

Mekurukito wrote: September 30th, 2019, 10:33 am i dont how to make the first system, please send some code to me.
Ok, but first please precise a little bit what have you thought to. What you mean by "input count"? What kind of input do you want to count? A few details please, before I start to write the needed code.
Mekurukito wrote: September 30th, 2019, 10:33 am the second system,i understand and i already learn how to do "Action Timer", you can give me a code if you want to
For instance:

Code: Select all

[Rainmeter]
Update=-1

[Variables]
MSec=0
StartStop=0
U=[!UpdateMeasure "MeasureSlide"][!UpdateMeter "MeterMilliseconds"][!Redraw]

[StringStyle]
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Forward,10,100
Forward=[!SetVariable MSec "(#MSec#+1)"]#U#
IfCondition=(#MSec#=100)
IfTrueAction=[!CommandMeasure "MeasureSlide" "Stop 1"][!SetVariable MSec "0"]#U#[!CommandMeasure "MeasureSlide" "Execute 1"]
DynamicVariables=1

[MeasureStartStop]
Measure=Calc
Formula=#StartStop#
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!CommandMeasure "MeasureSlide" "Execute 1"][!SetOption MeterStartStop Text "Stop"][!UpdateMeter "MeterStartStop"][!Redraw]
IfFalseAction=[!CommandMeasure "MeasureSlide" "Stop 1"][!SetOption MeterStartStop Text "Start"][!UpdateMeter "MeterStartStop"][!Redraw]
DynamicVariables=1

[MeterMilliseconds]
Meter=STRING
MeterStyle=StringStyle
X=0
Y=0
Text=#MSec#
DynamicVariables=1

[MeterStartStop]
Meter=STRING
MeterStyle=StringStyle
X=0r
Y=10R
LeftMouseUpAction=[!SetVariable StartStop "(1-#StartStop#)"][!UpdateMeasure "MeasureStartStop"]
DynamicVariables=1

[MeterReset]
Meter=STRING
MeterStyle=StringStyle
X=0r
Y=10R
Text=Reset
LeftMouseUpAction=[!SetVariable StartStop "0"][!SetVariable MSec "0"][!UpdateMeasure "MeasureStartStop"]#U#
This code for now only counts the ten milliseconds, going from 0 to 100, then restarting from 0. The seconds, minutes, hours have to be added later, but first please check this code and let me know what do you think about it.

Additional note: in Rainmeter those are not systems, but skins.
Mekurukito
Posts: 21
Joined: July 8th, 2018, 6:09 am

Re: Input Count Rainmeter skins

Post by Mekurukito »

So by what i mean "input count" is like every click i do will count from 0, and it will be counted +1 each click.
So if i click 5 times it will be registered as "5".

If you can, make it like you can save and reset the count
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Input Count Rainmeter skins

Post by balala »

Mekurukito wrote: October 1st, 2019, 12:38 am So by what i mean "input count" is like every click i do will count from 0, and it will be counted +1 each click.
So if i click 5 times it will be registered as "5".
Depends on what you mean by click. If the skin should count the click onto itself, this is possible. But if it should count any such action, no matter where have you clicked, well, this is not possible, unfortunately.
So, is it ok to register only the clicks onto the skin?
Mekurukito
Posts: 21
Joined: July 8th, 2018, 6:09 am

Re: Input Count Rainmeter skins

Post by Mekurukito »

One more thing that i want to add.
Can you make "up time" for last actions, and it will count "59second" after that change into 1+minutes not "60 seconds" ?
Mekurukito
Posts: 21
Joined: July 8th, 2018, 6:09 am

Re: Input Count Rainmeter skins

Post by Mekurukito »

balala wrote: October 1st, 2019, 6:21 am Depends on what you mean by click. If the skin should count the click onto itself, this is possible. But if it should count any such action, no matter where have you clicked, well, this is not possible, unfortunately.
So, is it ok to register only the clicks onto the skin?
Yes, just give me an example code, i have no idea how to make it
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Input Count Rainmeter skins

Post by balala »

Mekurukito wrote: October 1st, 2019, 6:27 am Yes, just give me an example code, i have no idea how to make it
Ok, first create a variable into the [Variables] section. Let's name it Count:

Code: Select all

[Variables]
Count=0
Now on every click you have to increase the value of this variable by one. Theoretically this might be done through a LeftMouseUpAction onto the [Rainmeter] section, but this won't work this way, because this section can't work with dynamical variables. Count will be a such dynamic variable, because it'll be updated by one on every click. The [Rainmeter] section simply can't deal with this, so we have to add a meter, which deals alright with dynamic variables.
So add the following meter as first meter of your skin (before the first already existing meter):

Code: Select all

[MeterClick]
Meter=Image
SolidColor=0,0,0,1
X=0
Y=0
W=#CURRENTCONFIGWIDTH#
H=#CURRENTCONFIGHEIGHT#
LeftMouseUpAction=[!SetVariable Count "(#Count#+1)"][!UpdateMeter "#CURRENTSECTION#"][!UpdateMeter "MeterShowClicks"][!Redraw]
DynamicVariables=1
If you add this meter, any click to the skin, outside of the meters which already have a LeftMouseUpAction option set up, will increase the value of the Count variable by one. The above already updated [MeterShowClicks] is a meter which will be added to show the number of already made clicks. You can add it as well, somewhere to the end of your code:

Code: Select all

[MeterShowClicks]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Number of clicks so far:#CRLF##Count#
DynamicVariables=1
Only one single problem remains: if you have meters which already have a LeftMouseUpAction option set up, the clicks onto them won't increase the value of the Count variable, so those clicks won't be counted. The question is if there are such meters. Are there?
Mekurukito
Posts: 21
Joined: July 8th, 2018, 6:09 am

Re: Input Count Rainmeter skins

Post by Mekurukito »

well its kinda not worth it if it can only do 1 meters for every click.
How about make a calculation on the variable? if i use the first meter and the second meter, like 1(first)+1(second)=2?

this the project that i want to do, its Key Counting
and well its not really work out, i cant do it using Hotkey Plugin, this is the code

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Count=0

[A_Key]
Measure=Plugin
Plugin=HotKey
HotKey=A
KeyDownAction=[!SetVariable Count "(#Count#+1)"][!UpdateMeter "#CURRENTSECTION#"][!UpdateMeter "MeterShowClicks"][!Redraw]
DynamicVariables=1

[MeterShowClicks]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Number of clicks so far:#CRLF##Count#
DynamicVariables=1