It is currently October 13th, 2019, 11:47 pm

[Suggestion] OnIncreaseAction & OnDecreaseAction

Report bugs with the Rainmeter application and suggest features.
Cariboudjan
Posts: 13
Joined: May 12th, 2019, 8:55 am

[Suggestion] OnIncreaseAction & OnDecreaseAction

Cariboudjan » September 28th, 2019, 7:14 pm

OnChangeAction is great, but what if someone only wants an action if the value increases or if the value decreases?

Use case: Using FileInfo plugin, I have a notification sound effect that plays when the number of files in the downloads folder changes, which lets me know when a file I'm downloading is complete. Because I can only use OnChangeAction, the notification plays when the number of files in the folder decreases as well, like when I delete files from the folder.

If I had an OnIncreaseAction option, I could fix this issue.

Code: Select all

[DownloadsCount]
Measure=Plugin
Plugin=Plugins\FolderInfo.dll
Folder="%USERPROFILE%\Downloads"
InfoType=FileCount
IncludeHiddenFiles=0
IncludeSubFolders=0
IncludeSystemFiles=0
RegExpFilter=(?!.*\.crdownload|.*\.partial|.*\.tmp|.*\.download)^.*$
OnChangeAction=[Play "Notification.wav"]
User avatar
balala
Rainmeter Sage
Posts: 8799
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Suggestion] OnIncreaseAction & OnDecreaseAction

balala » September 28th, 2019, 8:33 pm

Cariboudjan wrote:
September 28th, 2019, 7:14 pm
OnChangeAction is great, but what if someone only wants an action if the value increases or if the value decreases?
I think a such pair of option might be helpful, however it could be done even with the existing features.
For instance, the following code generates a random number between 0 and 100. Next to this number a symbol is show, indicating if the number has increased, decreased or didn't change:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,120
DynamicWindowSize=1

[Variables]
Change=0

[MeasureRandom]
Measure=Calc
Formula=Random
LowBound=0
HighBound=100
UpdateRandom=1
IfCondition=(#CURRENTSECTION#>#Change#)
IfTrueAction=[!SetVariable Direction "[\x2197]"]
IfCondition2=(#CURRENTSECTION#<#Change#)
IfTrueAction2=[!SetVariable Direction "[\x2198]"]
IfCondition3=(#CURRENTSECTION#=#Change#)
IfTrueAction3=[!SetVariable Direction "-"]
OnChangeAction=[!Delay "1000"][!SetVariable Change "[MeasureRandom]"][!UpdateMeter "MeterShow"][!Redraw]
DynamicVariables=1
UpdateDivider=2

[MeterShow]
Meter=STRING
MeasureName=MeasureRandom
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=%1 / #Direction#
DynamicVariables=1