It is currently March 28th, 2024, 4:38 pm

Measure Registry Multi-String?

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Measure Registry Multi-String?

Post by Yincognito »

jsmorley wrote: March 23rd, 2019, 2:46 pmIt's just not trivial to do. NULL is used by the C language to indicate the end of a string, and we would have to deal with that. binary values are another issue, as what do we return, the raw binary number, the number converted to HEX / Decimal. All, in all, a fair amount of thought and care would need to be put into this.
Now that explains it better. Since you put it that way, I'd have to at least partially agree.
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Measure Registry Multi-String?

Post by Yincognito »

StArL0rd84 wrote: March 23rd, 2019, 2:26 pm The measure only returns the first line, as if the substitute was not even there:
D:\Images\Vintage

'D:\Images\Futurism' is still missing...
I've already tested \0 substitutions on REG_MULTI_SZ values, and it does not work. Rainmeter gets the string only up until the NUL character, meaning that whatever substitution you try to do, it will only act on the first line of text from a REG_MULTI_SZ value.

Try using the CMD+reg query combo, like this (adapt it to your needs):

Code: Select all

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

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "PagingFiles"
State=Hide
OutputType=ANSI
RegExpSubstitute=1
Substitute="\r?\n":"","(?si)^.*REG_MULTI_SZ\s+":""

[MeterRun]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Click to Run
LeftMouseUpAction=[!CommandMeasure MeasureRun "Run"]

[MeterResult]
Meter=String
MeasureName=MeasureRun
Y=10R
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
This is getting a REG_MULTI_SZ value and then eliminates the unneeded parts from the string, leaving only its value.
Last edited by Yincognito on March 23rd, 2019, 3:39 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Measure Registry Multi-String?

Post by jsmorley »

Your conclusion is right. The Registry measure is going to read up to the first NULL character, which means "end of string", and will be done with it. The answer is going to be RunCommand and either a cmd or Powershell command to get the desired information.
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Measure Registry Multi-String?

Post by Yincognito »

And a PowerShell equivalent (as always, adapt it to your needs):

Code: Select all

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

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Program=powershell
Parameter=-command Get-ItemProperty -Path \"HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\" | Select-Object -ExpandProperty \"PagingFiles\"
State=Hide
OutputType=ANSI
RegExpSubstitute=1
Substitute="\r?\n":""

[MeterRun]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Click to Run
LeftMouseUpAction=[!CommandMeasure MeasureRun "Run"]

[MeterResult]
Meter=String
MeasureName=MeasureRun
Y=10R
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
The difference (and the reason it didn't work before) is that -command is needed before the actual command, and, of course, the command interpreter (which is still CMD) needs the quotes (") to be escaped by using \ before them.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure Registry Multi-String?

Post by balala »

StArL0rd84 wrote: March 23rd, 2019, 2:26 pm The measure only returns the first line, as if the substitute was not even there:
D:\Images\Vintage

'D:\Images\Futurism' is still missing...
And what if you don't add a Substitute option?
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: Measure Registry Multi-String?

Post by SilverAzide »

StArL0rd84 wrote: March 23rd, 2019, 7:41 am Tested Substitute="\0":"|" today and i'm afraid it does not work either.
Still only returns the first string.

I have never used Powershell together with Rainmeter before.
How do i format the measure?
The following measure only returns the number 103...
Yincognito's code is what you want. I only gave you the Powershell command line. Try this:

Code: Select all

[mMultiString]
Measure=Plugin
Plugin=RunCommand
Program=Powershell
Parameter=-Command "Get-ItemProperty -Path 'HKCU:\Software\Binary Fortress Software\DisplayFusion\Wallpaper\c01c88eb-b1af-446a-ba4c-d714a2c45fdd' | Select-Object -ExpandProperty Wallpaper_0_RotatePaths"
State=Hide
OutputType=ANSI
You will get the list of strings separated by CRLF, so you can replace these with something else using a Substitute if you want.
Last edited by SilverAzide on March 24th, 2019, 2:37 pm, edited 1 time in total.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Measure Registry Multi-String?

Post by StArL0rd84 »

balala wrote: March 23rd, 2019, 4:36 pm And what if you don't add a Substitute option?
Same deal
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Measure Registry Multi-String?

Post by Yincognito »

jsmorley wrote: March 23rd, 2019, 3:41 pm Your conclusion is right. The Registry measure is going to read up to the first NULL character, which means "end of string", and will be done with it. The answer is going to be RunCommand and either a cmd or Powershell command to get the desired information.
A little off-topic, but I discovered that the \0 badly needed to be escaped in my feeds skin as well, since when browsing these posts from Rainmeter's feed, it totally messed up the strings I was working with and the way things were displayed. I'm not yet sure if \0 was interpreted as the whole string or the end of the string, but once I escaped it, it all came back to normal.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure Registry Multi-String?

Post by balala »

StArL0rd84 wrote: March 23rd, 2019, 7:07 pmSame deal
I'm not too sure, but check Yincognito's above reply.
User avatar
Yincognito
Rainmeter Sage
Posts: 7025
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Measure Registry Multi-String?

Post by Yincognito »

SilverAzide wrote: March 23rd, 2019, 4:54 pmNote the UpdateDivider line, you probably don't need this running once a second, so it is best to do this one time and be done with it.
Just as a clarification, as far as I know, I don't think setting UpdateDivider=-1 in that measure you posted will make any difference, since according to the manual, the plugin will take no action unless triggered with a [!CommandMeasure TheRunCommandMeasureName "Run"] bang. Instead, what you'd want is to set UpdateDivider=-1 on the measure where the bang that triggers the RunCommand measure is, not on the actual RunCommand measure.

Of course, if the bang is executed within a mouse action, there will be no need for UpdateDivider=-1, since only that mouse action will trigger the running of the actual RunCommand measure.

A little convoluted system, I know - but from a logical point of view, it makes sense if you think about it.
Post Reply