It is currently November 22nd, 2019, 2:10 pm

Measure Registry Multi-String?

Help with creating, editing & fixing problems with skins
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Measure Registry Multi-String?

StArL0rd84 » March 22nd, 2019, 4:03 pm

I am trying to measure a key, but the measure only returns the first path before the line break in the multi-string.
Can't it retrieve both lines somehow?

I tried:
Substitute="#CRLF#":""

MultiString.png

Code: Select all

[mWallpaperShortPath0]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Software\Binary Fortress Software\DisplayFusion\Wallpaper\c01c88eb-b1af-446a-ba4c-d714a2c45fdd
RegValue=Wallpaper_0_RotatePaths
UpdateDivider=5
You do not have the required permissions to view the files attached to this post.
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
User avatar
balala
Rainmeter Sage
Posts: 9117
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure Registry Multi-String?

balala » March 22nd, 2019, 4:56 pm

StArL0rd84 wrote:
March 22nd, 2019, 4:03 pm
I tried:
Substitute="#CRLF#":""
Unfortunately as you know I don't have installed the incriminated software, so I can't check exactly what's going on, but an idea would be to replace the above substitution with the following two options:

Code: Select all

RegExpSubstitute=1
Substitute="\n":""
If this doesn't work, you can try changing the Substitute option with any of the following ones: Substitute="\n\r":"" or Substitute="\r":""
Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=18345&p=99586&hilit=new+line+regexpsubstitute#p99565
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Measure Registry Multi-String?

StArL0rd84 » March 22nd, 2019, 5:22 pm

balala wrote:
March 22nd, 2019, 4:56 pm
Unfortunately as you know I don't have installed the incriminated software, so I can't check exactly what's going on, but an idea would be to replace the above substitution with the following two options:

Code: Select all

RegExpSubstitute=1
Substitute="\n":""
If this doesn't work, you can try changing the Substitute option with any of the following ones: Substitute="\n\r":"" or Substitute="\r":""
Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=18345&p=99586&hilit=new+line+regexpsubstitute#p99565
Did not work but i'll look into the link you provided. thank you.
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
User avatar
SilverAzide
Posts: 609
Joined: March 23rd, 2015, 5:26 pm

Re: Measure Registry Multi-String?

SilverAzide » March 22nd, 2019, 6:17 pm

StArL0rd84 wrote:
March 22nd, 2019, 5:22 pm
Did not work but i'll look into the link you provided. thank you.
It's not working because the separator between REG_MULTI_SZ strings is not a carriage return, a line feed, or both. It is a NUL (0x0).
DeviantArt Gadgets More...
User avatar
balala
Rainmeter Sage
Posts: 9117
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure Registry Multi-String?

balala » March 22nd, 2019, 6:23 pm

SilverAzide wrote:
March 22nd, 2019, 6:17 pm
It's not working because the separator between REG_MULTI_SZ strings is not a carriage return, a line feed, or both. It is a NUL (0x0).
Ok and how do you write it in a Substitute option?
User avatar
SilverAzide
Posts: 609
Joined: March 23rd, 2015, 5:26 pm

Re: Measure Registry Multi-String?

SilverAzide » March 22nd, 2019, 10:33 pm

balala wrote:
March 22nd, 2019, 6:23 pm
Ok and how do you write it in a Substitute option?
I believe the null character is represented by "\0" in a regex expression. Hopefully Rainmeter supports this.

However, I'm not sure what the original poster is trying to do; his question was how to get all the values. By using a substitute to remove the separator, all you will end up doing is concatenating the individual strings together, which will render it useless. If the goal is to do something with the individual strings, then another approach is needed.

But if the goal is to concatenate everything into one long string, use:
Substitute="\0":""
DeviantArt Gadgets More...
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Measure Registry Multi-String?

StArL0rd84 » March 22nd, 2019, 10:44 pm

SilverAzide wrote:
March 22nd, 2019, 10:33 pm
I believe the null character is represented by "\0" in a regex expression. Hopefully Rainmeter supports this.

However, I'm not sure what the original poster is trying to do; his question was how to get all the values. By using a substitute to remove the separator, all you will end up doing is concatenating the individual strings together, which will render it useless. If the goal is to do something with the individual strings, then another approach is needed.

But if the goal is to concatenate everything into one long string, use:
Substitute="\0":""
Yes, i need to separate the individual strings somehow.
Have not tried "\0" yet.
Will try tomorrow.
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
Yincognito
Posts: 682
Joined: February 27th, 2015, 2:38 pm

Re: Measure Registry Multi-String?

Yincognito » March 22nd, 2019, 11:16 pm

StArL0rd84 wrote:
March 22nd, 2019, 4:03 pm
I am trying to measure a key, but the measure only returns the first path before the line break in the multi-string. Can't it retrieve both lines somehow?
I don't think so. As per Rainmeter's manual, the only two registry key value types supported by Rainmeter are REG_SZ (string) and REG_DWORD (number). If the value of your key is of REG_MULTI_SZ type (registry key value types available here) - and from your post it certainly seems to be the case - then it can't be retrieved by Rainmeter past the NUL character.

I've encountered the issue as well, and I've even made a feature request for the REG_MULTI_SZ type to be supported by Rainmeter here, but so far, no answer. Maybe if more users keep pushing for this feature, it will give the devs some incentive to implement it, who knows... :confused:
Last edited by Yincognito on March 23rd, 2019, 12:03 am, edited 1 time in total.
Yincognito
Posts: 682
Joined: February 27th, 2015, 2:38 pm

Re: Measure Registry Multi-String?

Yincognito » March 23rd, 2019, 12:02 am

SilverAzide wrote:
March 22nd, 2019, 10:33 pm
I believe the null character is represented by "\0" in a regex expression. Hopefully Rainmeter supports this.

However, I'm not sure what the original poster is trying to do; his question was how to get all the values. By using a substitute to remove the separator, all you will end up doing is concatenating the individual strings together, which will render it useless. If the goal is to do something with the individual strings, then another approach is needed.

But if the goal is to concatenate everything into one long string, use:
Substitute="\0":""
The null character is indeed supported in a regex expression, but it is treated by many programming languages (including the C programming language that Rainmeter is written into, according to this) as the end of the string. So it might not be a subject to a Rainmeter regex substitute, since it won't be a part of the actual string, but rather a string array separator in the REG_MULTI_SZ type.
User avatar
SilverAzide
Posts: 609
Joined: March 23rd, 2015, 5:26 pm

Re: Measure Registry Multi-String?

SilverAzide » March 23rd, 2019, 2:45 am

Yincognito wrote:
March 23rd, 2019, 12:02 am
The null character is indeed supported in a regex expression, but it is treated by many programming languages (including the C programming language that Rainmeter is written into, according to this) as the end of the string. So it might not be a subject to a Rainmeter regex substitute, since it won't be a part of the actual string, but rather a string array separator in the REG_MULTI_SZ type.
Yes.. what we don't know (maybe you've already tried it and do know) is whether Rainmeter (or, more specifically, the Win32 API Rainmeter uses) will read the registry entry up to the first null and stop, or will it read in the entire buffer into memory, nulls and all. If the latter, then you won't be able to see the strings after the first null, but they will be there and could be made available with a substitute to get rid of embedded nulls.

Either way, you CAN read a REG_MULTI_SZ registry entry using Rainmeter. It requires Powershell and a little command-line kung fu, but you could easily do it with a Command measure. One example:

Code: Select all

PS> Get-ItemProperty -Path "HKCU:\Software\Binary Fortress Software\DisplayFusion\Wallpaper\c01c88eb-b1af-446a-ba4c-d714a2c45fdd" | Select-Object -ExpandProperty Wallpaper_0_RotatePaths
That will dump out a list of strings you could then grab and parse however you like. With a little creativity, you can probably alternatively format the text as a single string joined together with a separator of your choice (e.g., "string1;string2;string3")
DeviantArt Gadgets More...