Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1663

Bugs & Feature Suggestions • Re: A question about "Registry Measure"

$
0
0
At first I thought I could do something like IfMatch=^0$ but noup, it doesn't work. Then I thought well, I use substitute to replace that 0 for some string and then use ifMatch with that string but noup, it doesn't work. If I use something like IfMatch=0 then it would disable even if the string is "0 RPM" which is not the desired behavior.
For anyone reading this in the future, here's one way for IfMatch to deal with valid / existing and invalid / inexistent registry values:

Code:

[Variables]RegValue0=ProductNameRegValue1=Bla-Bla-BlaIndex=0Rating=Valid = Yeah[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1BackgroundMode=2SolidColor=0,255,0,255---Measures---[Value]Measure=RegistryRegHKey=HKEY_LOCAL_MACHINERegKey=Software\Microsoft\Windows NT\CurrentVersionRegValue=[#RegValue[#Index]]IfMatch=^.{1,}$IfMatchAction=[!SetVariable Rating "Valid = Yeah"]IfNotMatchAction=[!SetVariable Rating "Valid = Nope"]DynamicVariables=1---Meters---[Result]Meter=StringAntiAlias=1Text=[#RegValue[#Index]] = [Value] (#Rating#)LeftMouseUpAction=[!SetVariable Index (1-#Index#)][!UpdateMeasure Value][!UpdateMeter Result][!Redraw]DynamicVariables=1
This approaches things the other way around, i.e. instead of testing whether the value is not existing via the ^$ or ^0$ regex patterns, it tests whether the value exists aka it has more than one character in length. It also avoids the need to check for a "0" value which might very well be valid and existing, not to mention being confusing in terms of the equivalence involved.

Statistics: Posted by Yincognito — Yesterday, 10:27 pm



Viewing all articles
Browse latest Browse all 1663

Trending Articles