It is currently June 27th, 2019, 11:09 am

Measure information from application

Help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 8320
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure information from application

balala » June 8th, 2019, 6:01 pm

Langlu wrote:
June 8th, 2019, 5:47 pm
Regardless of the application, is there a command in Rainmeter that can store what the skin is displaying (through a meter) as a text file (as well as display it, which I now know how to do).
Yes, it is. The !WriteKeyValue bang can do this. For example add the following option to the WebParser measure which returns the value: OnChangeAction=[!WriteKeyValue Variables MyVariable "[#CURRENTSECTION#]" "#@#Information.inc"], along with a DynamicVariables=1 option. The bangs of an OnChangeAction option are executed when the value returned by the measure where it is placed in, is changing. So whenever this measure gets a new value, the !WriteKeyValue bang is executed and this bang writes the value of the measure into the MyVariable variable, within the [Variables] section of the Information.inc file, existing into the @Resources folder. Note that you can write this value into any .ini formatted file, regardless where is it placed, just have to add its path as the last parameter of the !WriteKeyValue bang. Also note that the file MUST exist (it isn't created if it doesn't exist) and it MUST have a .ini file structure, having a [Variables] section.
User avatar
Langlu
Posts: 13
Joined: June 7th, 2019, 11:49 pm

Re: Measure information from application

Langlu » June 8th, 2019, 6:42 pm

balala wrote:
June 8th, 2019, 6:01 pm
Yes, it is. The !WriteKeyValue bang can do this. For example add the following option to the WebParser measure which returns the value: OnChangeAction=[!WriteKeyValue Variables MyVariable "[#CURRENTSECTION#]" "#@#Information.inc"], along with a DynamicVariables=1 option. The bangs of an OnChangeAction option are executed when the value returned by the measure where it is placed in, is changing. So whenever this measure gets a new value, the !WriteKeyValue bang is executed and this bang writes the value of the measure into the MyVariable variable, within the [Variables] section of the Information.inc file, existing into the @Resources folder. Note that you can write this value into any .ini formatted file, regardless where is it placed, just have to add its path as the last parameter of the !WriteKeyValue bang. Also note that the file MUST exist (it isn't created if it doesn't exist) and it MUST have a .ini file structure, having a [Variables] section.
Thanks, will go through this soon!
User avatar
balala
Rainmeter Sage
Posts: 8320
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure information from application

balala » June 8th, 2019, 6:46 pm

Langlu wrote:
June 8th, 2019, 6:42 pm
Thanks, will go through this soon!
Ok. If you have questions, feel free to come back.
User avatar
Langlu
Posts: 13
Joined: June 7th, 2019, 11:49 pm

Re: Measure information from application

Langlu » June 9th, 2019, 11:37 am

balala wrote:
June 8th, 2019, 6:46 pm
Ok. If you have questions, feel free to come back.
It works! But what about writing the string of multiple measure values to the information.ini file?

Code: Select all

[MeterLaunchImageSSD1]
Meter=Image
ImageName=#@#ssd.png
W=15
H=15
X=10
Y=35
MouseOverAction=[!ShowMeter HoverActiveSSD1]
MouseLeaveAction=[!HideMeter HoverActiveSSD1]
LeftMouseUpAction=[!WriteKeyValue Variables MyVariable1 [MeasureUser1SSD1] "#@#Information.ini"]
LeftMouseUpAction=[!WriteKeyValue Variables MyVariable2 [MeasureUser2SSD1] "#@#Information.ini"]
DynamicVariables=1
With this, only MyVariable1 works and shows Value of MeasureUser1SSD1.
But MyVariable2 is empty and not showing Value of MeasureUser2SSD1


EDIT: FIXED, I SHOULDNT HAVE TWO LEFTMOUSEUPACTIONS, JUST ONE WITH MULTIPLE !WRITEKEYVALUE.
Last edited by balala on June 9th, 2019, 1:53 pm, edited 5 times in total.
Reason: When posting code snippets, please post it between <code> tags. It can be done with the </> button.
User avatar
Langlu
Posts: 13
Joined: June 7th, 2019, 11:49 pm

Re: Measure information from application

Langlu » June 9th, 2019, 12:08 pm

balala wrote:
June 8th, 2019, 6:01 pm
add the following option to the WebParser measure which returns the value
You did say to add this to the MeasureUserSSD1 which is actually the measure with the webparser, but I have two issues with it:

Does this mean it will write to the information.ini file, every time the value changes? What is if this is very frequent (i.e, a very low update rate?). This might be too much. I just want to view the information at regular rate, but not write to a file so often.
User avatar
balala
Rainmeter Sage
Posts: 8320
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure information from application

balala » June 9th, 2019, 3:34 pm

Langlu wrote:
June 9th, 2019, 11:37 am
With this, only MyVariable1 works and shows Value of MeasureUser1SSD1.
But MyVariable2 is empty and not showing Value of MeasureUser2SSD1
Every option of every section can be used only once. If you add secondly the same option, the second occurrence of it is ignored. That's why MyVariable1 was written properly, while MyVariable2 wasn't.
Note that not just the options can't be doubled, nor the section names can't. If you do double a section name into one single skin, the second occurrence of it is ignored as well as the second occurrence of the option.
This is the way as .ini files are working. No doubling anything.
User avatar
balala
Rainmeter Sage
Posts: 8320
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure information from application

balala » June 9th, 2019, 3:43 pm

Langlu wrote:
June 9th, 2019, 12:08 pm
Does this mean it will write to the information.ini file, every time the value changes?
The bangs of an OnChangeAction option are executed whenever the value of the measure you added the option to is changing. Note that you don't have to add this option to the parent WebParser measure, but to the child one, which returns the value.
Langlu wrote:
June 9th, 2019, 12:08 pm
What is if this is very frequent (i.e, a very low update rate?). This might be too much. I just want to view the information at regular rate, but not write to a file so often.
If you did what I've described above, the value is written every time the value of the measure is changing. Usually this isn't an issue, it can be written as often as you want, won't cause any troubles.